I recently had basically the same problem that I'm having right now, which was covered and solved in this thread:
https://www.accessforums.net/queries...tml#post258158
Basically, I'm trying to return records where the TransDateTime is greater than 7 am on the current day. This table is linked to a CSV that is generated by SQL server, so all the data types of the table are text.
Here is the current WHERE clause:
WHERE CDATE(LEFT(TransDateTime, 19)) >= FORMAT(Date(),"YYYY/MM/DD 07:00:00");
However, this is causing a Data type mismatch error. The interesting thing is, if I use <= instead of >= (or if I keep the same sign, but switch the Date() value to the left side and TransDateTime to the right), the query runs fine. So in other words, I can return records that occurred before 7:00 am on the current date, but not records that occurred after 7:00 am on the current date.
Does anyone have any idea why it doesn't cause a data type mismatch when using less than, but does cause a data type mismatch when using greater than? And of course, any actual solutions would be deeply appreciated. Thank you.
-Chris