Link to home
Start Free TrialLog in
Avatar of GPSPOW
GPSPOWFlag for United States of America

asked on

Access Query on Date/Time not allowing criteria

I am writing a query in MS-Access using a SQL linked data table.  The field, ServiceDateTime is a Date/Time format.  When I look at the data it comes across as 9/20/13 8:52:00 AM.

When I enter the criteria =#9/20/13# I get no data returned.

How can transform the data to allow date criteria?

Thanks

Glen
Avatar of chaau
chaau
Flag of Australia image

The data in your table has a time component. So, you can't just compare it with date only. You need to truncate the time value from the data. The simplest way to do so is to use Date() function, like this:

In the field write this expression:
DateOnly: Date([YourTable].[yourColumn])
In the criteria write your criteria:
=#9/20/13#
try  this criteria

where datevalue([ServiceDateTime])=#9/20/2013#
Avatar of GPSPOW

ASKER

Neither solution worked.

The first said I had the wrong amount of arguments

The second said data type mismatch

Glen
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GPSPOW

ASKER

That worked.

Thanks

Glen
Avatar of GPSPOW

ASKER

thanks