On my form I have two textboxes where the user can enter a 'From' and a 'To' date. A query is then created that returns records between these dates. The result is displayed in a subform, by setting the subforms recordsource to the query like this:
"Me.RepQ_items_per_manufacturer_subform.Form.RecordSource = strQuery".
The problem is that Access (2007) seems to mix up the UK (MM-DD-YYYY) and EU (DD-MM-YYYY) date formats sometimes. When I input in the textboxes from: 01-01-2011 to: 01-03-2011 (jan 1st to march 1st) the query returns results between jan 1st and jan 3rd. But when I input from: 01-01-2011 to: 31-03-2011 (jan 1st to march 31st) the query correctly returns the results between jan 1st and march 31st.
I pass on the dates to the query without any modifications. While debugging I see the dates are correct in the query that is run:
"...WHERE (((Item_Query.ReceivedDate) Between #1-1-2011# And #1-3-2011#))" and
"...WHERE (((Item_Query.ReceivedDate) Between #1-1-2011# And #31-3-2011#))". Yet 01-03-2011 is interpreted as jan 3rd, and 31-03-2011 is interpreted as march 31st.
I would expect the EU date format, since thats how it formatted in all the tables, forms, and queries. But when I look at queries in SQL view, I see the dates are in UK format. So I am a bit confused.
Does anyone know how to fix this?
"Me.RepQ_items_per_manufacturer_subform.Form.RecordSource = strQuery".
The problem is that Access (2007) seems to mix up the UK (MM-DD-YYYY) and EU (DD-MM-YYYY) date formats sometimes. When I input in the textboxes from: 01-01-2011 to: 01-03-2011 (jan 1st to march 1st) the query returns results between jan 1st and jan 3rd. But when I input from: 01-01-2011 to: 31-03-2011 (jan 1st to march 31st) the query correctly returns the results between jan 1st and march 31st.
I pass on the dates to the query without any modifications. While debugging I see the dates are correct in the query that is run:
"...WHERE (((Item_Query.ReceivedDate) Between #1-1-2011# And #1-3-2011#))" and
"...WHERE (((Item_Query.ReceivedDate) Between #1-1-2011# And #31-3-2011#))". Yet 01-03-2011 is interpreted as jan 3rd, and 31-03-2011 is interpreted as march 31st.
I would expect the EU date format, since thats how it formatted in all the tables, forms, and queries. But when I look at queries in SQL view, I see the dates are in UK format. So I am a bit confused.
Does anyone know how to fix this?