Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error when opening a recordset 1

Status
Not open for further replies.

Davide77

Technical User
Mar 6, 2003
166
CH
hallo I am trying to open a recordset with a where condition but I get the run - time error 3075 "Syntax error in number in query expression '[Qry_Room].[Day]=10.11.2002'"
The code I'm using is:


strSql = "SELECT [Qry_Room].[Room] FROM [Qry_Room] WHERE [Qry_Room].[Day]=" & giorno
Set rs = dBase.OpenRecordset(strSql, dbOpenDynaset)

Does someone have an idea?
 
giorno holds '10.11.2002'
If the [Day] field is a date, then you need to convert the value in giorno to a date, and surround it with # characters.

Thus "....[Day] = #" & format(cdate(giorno),"dd-mm-yyyy") & "#"

or similar.

(I am not sure what order your day/month values appear in Italy(?)..)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top