MS Access ODBC query Dates
Author
Discussion

shocker-z

Original Poster:

554 posts

249 months

Monday 21st May 2007
quotequote all
I need to pull up records on dats but the format of the dates in the database are "21/05/2007 17:01:54" so my query

SELECT Maintenance_ID
FROM Maintenance_Dbf
WHERE [Date Logged] = $today


Will not return any results.. do i need to somehow say if it's greater than..? and add 00:00:00 so everything today is greater than 21/05/2007 00:00:00?


Regards
Liam

_dobbo_

14,619 posts

279 months

Monday 21st May 2007
quotequote all
How about instead of using "=" use "like"?

eg: LIKE $today%

edit - I'm assuming $today is a date!




Edited by _dobbo_ on Monday 21st May 17:44

shocker-z

Original Poster:

554 posts

249 months

Monday 21st May 2007
quotequote all
I've tryed that also but get error saying its the incorect use.. which it is as % is in a string and this is classed as numeric, i tried that also inside '' but then get error saying incorect data type.


any more ideas?


Thanks

_dobbo_

14,619 posts

279 months

Monday 21st May 2007
quotequote all
Well I know less than nowt about access but you might get away without using the % althogether, just use

LIKE $today

shocker-z

Original Poster:

554 posts

249 months

Monday 21st May 2007
quotequote all
Sorry i have tried that also.. lol


Sorry my fault i should have said, it's even blank in acess so it's not an issue with the connection.