But '12/16/2003 4:12:09 PM' isn't a date value, it's a string (and lacking enclosing
quotes, at that).
You will need to enclose your date literal inside hash marks - #12/16/2003 4:12:09 PM#
- for Access. Whether it'll handle a date/time string in this format I don't know.
It probably will, but you may wish to format up just the information you want Access
to use (e.g. date but no time).
I'd also recommend not using a date in mm/dd/yyyy format, as you can strike
compatibility problems with systems that handle dates as dd/mm/yyyy (not so big a
problem if both the code and the Access engine are on the same machine, but dangerous
if more than one machine is involved, and fatal once the client-side browsers start
getting into the act). I always format date strings as yyyy/mm/dd which removes any
possibility of confusion.
Dave S
----- Original Message -----
From: professorw999
To: [EMAIL PROTECTED]
Sent: Friday, September 17, 2004 6:14 AM
Subject: [ASP] SQL Syntax Error
My mySQL statement below is returning this error:
"Syntax error (missing operator) in query expression 'MfgID = 3629
AND DateContacted > 12/16/2003 4:12:09 PM'." It worked until I
added the DateContacted > dtTempDate part. DateContacted is a date
field in Access.
Any ideas?
IF Request.QueryString("M") = "6" OR Request.QueryString("M") = "9"
THEN
intM = Request.QueryString("M")
ELSE
intM = "3"
END IF
intID = Request.Cookies("SRSMemberCookie")("I")
dtTempDate = DateAdd ("m", -intM, Now())
mySQL = "SELECT * FROM tblRequests WHERE MfgID = " & intID & " AND
DateContacted > " & dtTempDate & " ORDER BY DateContacted DESC"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open mySQL, objConn
Thanks,
PW
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.762 / Virus Database: 510 - Release Date: 13/09/04
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/17folB/TM
--------------------------------------------------------------------~->
---------------------------------------------------------------------
Home : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post : [EMAIL PROTECTED]
Subscribe : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/active-server-pages/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/