Quantcast
Viewing all articles
Browse latest Browse all 13329

Query with dd/mm/yyyy returns records with mm/dd/yyyy

Hi All,

Hope there's someone who can help me out with this strange problem.

I am trying to run a query in Access with a simple sql string

below is my code

SQL = "Select * from stock where sdate = #11/12/2013"

Set qdf = CurrentDb.CreateQueryDef("secondqry", SQL)

DoCmd.OpenQuery "secondqry", acViewNormal, acReadOnly

The result returns with the record with the date 12/11/2013 <----wrong

if I run the query with the date 12/11/2013, the result records are with date 11/12/2013 <----wrong

if i run the query with the date 28/06/2013, the results records return with 28/12/2013 <--- no problem with such kind of very obvious formatted date.

Some basic info:

my Date field in the Access Table is Short Date
I created the query in the Access database and run there to see the results and results seem ok.

only when passing from the Codes that is somehow changing the date dd/mm/yyyy to mm/dd/yyyy

Strangely enough, 28/06/2013 is not giving any problem and giving me correct results.


Any idea?

Any suggestion would be greatly appreciated...

Viewing all articles
Browse latest Browse all 13329

Trending Articles