Access 2016 date picker changing date format
Posted on 2016-08-31
I am running Access 2016 in Windows 10. I have a form with a text box that displays dates. It is set to show the date picker. The text box Format property is set to Long Date. In the Load event for the form, the text box is set to Format(Now(), "Long Date") and all displays well when it first opens. However, when I use the date picker to select a date, it displays as the correct long date but the Me.textbox.value property has the date in a dd/mm/yyyy format. This causes a problem when I use this value for a date comparison with database table dates that are stored in a date field, which compare as mm/dd/yyyy. If I pick today's date to find in the database, the database date will be 08/31/2016 and the me.textbox.value will be 03/08/2016. I determined this in debug mode.
I tried Format(Me.textbox.value, "mm/dd/yyyy") but still got 03/08/2016. The only way to get the right date is Format(Me.textbox.value, "dd/mm/yyyy")! That gives me 08/31/2016, which is crazy.
What is going on here?