Sql for date problem

kabilliu

Registered User.
Local time
Today, 16:02
Joined
Nov 2, 2012
Messages
18
[SOLVED] Sql for date problem

I have the following sql statement to update some records to a table by a form:
Code:
Set rs = cdb2.OpenRecordset("SELECT * FROM tblSpy WHERE ID=" & Me.cbxItems.Value & " And [SpyDate]=#" & Me.saleDate & "#", dbOpenDynaset)
I believe that he problem is on Date syntax. The format of my date field is short date (dd/mm/yyyy).
I appreciate any help
Thank you in advance
 
Last edited:
Re: Sql for date problem (SOLVED)

Ok I solved my code problem as following:
Code:
Set rs = cdb2.OpenRecordset("SELECT * FROM tblSpy WHERE ID=" & Me.cbxItems.Value & " And [SpyDate]=#" & Format(Me.saleDate, "yyyy-mm-dd") & "#", dbOpenDynaset)
 

Users who are viewing this thread

Back
Top Bottom