Access 2003: sql statement question

Dear all,

i'm trying to get the following code to work without success:

String com = "SELECT Instrument.Index FROM Instrument WHERE Instrument.NextCalDate < #5/24/2007#";

s.execute(com);

I get the following error: Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Instrument.NextCalDate < #5/24/2007#'.

It is because of the <. If i change the < by an = it works fine. The annoying thing is that i've been browsing the forum and some date related questions regarding java/access were explained by giving example code that had the exact same syntax as the code i'm using, so with the use of the < character without using escape characters or whatever. These postings however date from 2004 or something, so what has changed?

I'm using latest JDK, Access 2003 and am connecting via ODBC running on an XP Pro machine.

Help is very much appreciated. Thanks from The Netherlands

Message was edited by:

bassiedude

[1064 byte] By [bassiedudea] at [2007-11-27 6:19:45]
# 1
I suspect one thing that changed was that those other examples were using a previous version of MS Access.Other than that I can only suggest that you use a prepared statement rather than attempting to the MS Access specific syntax.
jschella at 2007-7-12 17:34:39 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
Thanks for your reply. I managed to get it to work in the original form, but changed the date format.. Weird but it works..Thanks again.
bassiedudea at 2007-7-12 17:34:39 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...