Link to home
Start Free TrialLog in
Avatar of Graeme McGilvray
Graeme McGilvrayFlag for Australia

asked on

Microsoft JET Database Engine error '80040e14' Syntax error (missing operator) in query expression

Hi All, getting this error and not sure why I am, little help?
Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'event_code=code_short AND e.event_ID=s.event_ID AND event_location=location_ID AND event_live=TRUE AND session_date=>#13/9/2016# AND session_stime>#14:31#'.

/home2.asp, line 1214

Open in new window

TodayDate=Day(Now)&"/"&Month(Now)&"/"&Year(Now)
TodayTime=Hour(Now)&":"&Minute(Now)
Set NextEvent=oConn.Execute("SELECT * FROM events e,locations,codes,event_sessions s WHERE event_code=code_short AND e.event_ID=s.event_ID AND event_location=location_ID AND event_live=TRUE AND session_date=>#"&TodayDate&"# AND session_stime>#"&TodayTime&"# ORDER BY session_date,session_stime")

Open in new window

SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Graeme McGilvray

ASKER

Thanks for the Ryan, I get this error:
Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'event_code=code_short AND e.event_ID=s.event_ID AND event_location=location_ID AND event_live=TRUE AND session_date=> now()'.

/home2.asp, line 1331

Open in new window


or did you mean directly in the database?
>>or did you mean directly in the database?
yes... directly in db.. put the "Now()" into your sql statement as part of the string.

you can also do this and tell us what is generated?

SQLstr = "SELECT * FROM events e,locations,codes,event_sessions s WHERE event_code=code_short AND e.event_ID=s.event_ID AND event_location=location_ID AND event_live=TRUE AND session_date=> now() "
response.write SQLstr
response.end
Set NextEvent=oConn.Execute(SQLstr) 

Open in new window

Hi Ryan, I have just run the Query in the DB and it shows an error (same as previous)
hi, can you show the SQL generated here? is Access your database?
Yes Access is my database

nothing was generated from Query, just the error when I Run it
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oppps and nice spotted on Big Monty
Thanks guys, works for the date, now just need to get the time part working 
For the time,  use the same format :

timeColumn >= timeParameter
Tried it with Now() and it didn't work
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh! Time works! Thanks BigMonty!