By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,107 Members | 1,323 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,107 IT Pros & Developers. It's quick & easy.

SQL Date filter problem

100+
P: 171
Hi I have a query in access as follows:
Expand|Select|Wrap|Line Numbers
  1. strSqlBANK = "SELECT Dt , SumOfAmount " & _
  2. "FROM tblCASHBanked WHERE Dt = #" & dtBank & "#"
  3.  
dtBank has been dimmed as a date

What happens is that dtBank will = 01/07/2008, but when I interogate the recordset !Dt = 07/01/2008.

I get two different values
when I run the following code:
Expand|Select|Wrap|Line Numbers
  1. msgbox Format(dtBank,"dd mmmm yyyy")
the result is : 01 July 2008
however when I run this code:
Expand|Select|Wrap|Line Numbers
  1. rst.Open strSqlBANK, cnn, adOpenDynamic, adLockOptimistic
  2. with rst
  3. msgbox Format(!dt,"dd mmmm yyyy")
  4. end with
  5.  
The result is: 07 January 2008

It is driving me absolutley nuts
Dec 12 '08 #1
Share this Question
Share on Google+
2 Replies


FishVal
Expert 2.5K+
P: 2,653
SQL accepts date constants in m/d/y format only.

Regards,
Fish
Dec 12 '08 #2

100+
P: 171
ok, Thanks a lot FishVal
Dec 14 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.