date parameter in sql

jillrein

Registered User.
Local time
Today, 02:06
Joined
Apr 19, 2008
Messages
28
Please can anyone help. I'm running the following query to find records either 1 week or four weeks earlier. I set the value of i to 7 or 28 accordingly. It runs ok but does not return any results even

strsql = "SELECT registerDate, " & _
"sessionID, RegisterID FROM RegisterHeader " & _
"WHERE (registerheader.registerDate)= #" & _
DateAdd("d", -i, [Forms]![registerheader]![regDate]) & _
"# ORDER BY registerdate;"

Set rsprevious = CurrentDb.OpenRecordset(strsql)
setting a watch on strsql returns the following

"SELECT registerDate, sessionID, RegisterID FROM RegisterHeader WHERE (registerheader.registerDate)= #23/03/2009# ORDER BY registerdate;"

There are records in the table for 23/03/09. I have tried it with and without the # symbols - I don't think I need them but it doesn't work either way.

:(
 
Thank you so much. This is exactly the problem - I can now enjoy my weekend! Hope you do too.
 

Users who are viewing this thread

Back
Top Bottom