Problems with sql in access, incompatible data types

Asked

Viewed 612 times

1

Image of the test/error:

Erro de consulta ao Access

I only intend to search the data between a date and another, using:

SELECT * FROM tblTRAZA
WHERE FECMOV >= '2013-01-03'
AND FECMOV <= '2013-01-09';

But I’ve tried other date formats for query like yyyy/mm/dd, I tried to use only the date without the hours, and as in the image, I tried to use a specific date that I had already registered, but this error haunts me. You may have to change the table date structure?

  • 1

    I broke my head a little and managed to discover the date format used by access here, and it was like this: SELECT * FROM tblTRAZA WHERE (((tblTRAZA.FECMOV)>=#5/30/2014 00:00:00#) AND ((tblTRAZA.FECMOV)<=#5/31/2014 23:59:59#)) BY FECMOV order;

  • 2

    glad you could. Post as an answer and mark it as resolved so you can help future visitors!

1 answer

1

I broke my head a little bit and I was able to figure out the date format used by access in the case of this bank, and it was like this:

SELECT *
FROM tblTRAZA
WHERE (tblTRAZA.FECMOV BETWEEN #5/20/2014 00:00:00# And #5/31/2014 23:59:59#)

The date fields are understood by the access sql when you put the full date between '#' (old kkk game), and the date format was placed as MM/DD/YYYY.

NOTE: the bank is in MDB (ACCESS 2002 format)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.