Error: Data type mismatch in criteria expression

Joined
Apr 13, 2012
Messages
1
Reaction score
0
I'm trying to run 2 queries from the same table. The queries are identical, save for the location the item I'm investigating was ordered from. For whatever reason, query 1 works just fine. Query 2 works fine until I add in the criteria that I only want results between 4 and 9. When I enter that and try to run the query, I get the "data type mismatch" error. Any help is appreciated!

Query 1 - Fine:
SELECT DISTINCT CLOZ.RegNumber, CLOZ.OrderLocation, CLOZ.Patient, CLOZ.DrawnDateTime, CLOZ.DrawnID, Format([DrawnDateTime],"hh") AS [Hour], Format([DrawnDateTime],"mm/dd/yy") AS [Date]
FROM CLOZ
WHERE (((CLOZ.OrderLocation)="EVAH" Or (CLOZ.OrderLocation)="GHTM" Or (CLOZ.OrderLocation)="NSAC" Or (CLOZ.OrderLocation)="SLTC" Or (CLOZ.OrderLocation)="SSAC") AND ((CLOZ.DrawnDateTime)>#3/1/2012# And (CLOZ.DrawnDateTime)<#4/1/2012#) AND ((Format([DrawnDateTime],"hh")) Between 4 And 9));
Query 2 - Error:
SELECT DISTINCT CLOZ.RegNumber, CLOZ.OrderLocation, CLOZ.Patient, CLOZ.DrawnDateTime, CLOZ.DrawnID, Format([DrawnDateTime],"hh") AS [Hour], Format([DrawnDateTime],"mm/dd/yy") AS [Date]
FROM CLOZ
WHERE (((CLOZ.OrderLocation)="ARBO" Or (CLOZ.OrderLocation)="BECH" Or (CLOZ.OrderLocation)="MEDO" Or (CLOZ.OrderLocation)="MAPL") AND ((CLOZ.DrawnDateTime)>#3/1/2012# And (CLOZ.DrawnDateTime)<#4/1/2012#) AND ((Format([DrawnDateTime],"hh")) Between 4 And 9));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top