barrysprout
MIS
I can’t get a select query to recognise date criteria.
I want to select records between Jan 1st and the current date of any given year. The year is referenced from a control on an unbound form where the user selects various criteria. I have used the dateserial function as below to get the date format for the criterion but when I run the query I get no results. When I evaluate each dateserial function in the immediate window, I get the correct dates I'm after. If I reverse the date order to make it yyyy/mm/dd, the query gives me all data in the table.
Between DateSerial([Forms]![ChSumArea]![Yr],1,1) And DateSerial([Forms]![ChSumArea]![Yr],Month(Now()),Day(Now()))
My system date format is dd/mm/yyyy
Any suggestions?
I want to select records between Jan 1st and the current date of any given year. The year is referenced from a control on an unbound form where the user selects various criteria. I have used the dateserial function as below to get the date format for the criterion but when I run the query I get no results. When I evaluate each dateserial function in the immediate window, I get the correct dates I'm after. If I reverse the date order to make it yyyy/mm/dd, the query gives me all data in the table.
Between DateSerial([Forms]![ChSumArea]![Yr],1,1) And DateSerial([Forms]![ChSumArea]![Yr],Month(Now()),Day(Now()))
My system date format is dd/mm/yyyy
Any suggestions?