andrewboast
New member
- Local time
- Today, 19:57
- Joined
- Jun 15, 2016
- Messages
- 5
I am trying to query a set of records on a date field via code using memory variables as below:
dtFrom = Format(dtFrom, "dd/mm/yy")
dtTo = Format(dtTo , "dd/mm/yy") '
I have also tried using CDate in both cases the set of records return a selection that is equivalent to the dates being American format i.e. (mm/dd/yy) instead of the British format I have set. When I use the debug to print the sql string it shows the dates in the British format (dd/mm/yy). The regional settings and language setting on the PC are all British.
To confirm my theory if I enter the dates directly (American Format) in the sql string rather than using variables then I get the expect set of records.
To clarify when I use variables to restrict the records between 01/09/2016 and 04/09/2016 it returns records between 09/01/2016 and 09/04/2016.
However if enter the dates directly using the American setting #09/01/2016# and #09/04/2016# I get the expected set records over the 4 days.
Any assistance would be very welcome.
Andrew
dtFrom = Format(dtFrom, "dd/mm/yy")
dtTo = Format(dtTo , "dd/mm/yy") '
I have also tried using CDate in both cases the set of records return a selection that is equivalent to the dates being American format i.e. (mm/dd/yy) instead of the British format I have set. When I use the debug to print the sql string it shows the dates in the British format (dd/mm/yy). The regional settings and language setting on the PC are all British.
To confirm my theory if I enter the dates directly (American Format) in the sql string rather than using variables then I get the expect set of records.
To clarify when I use variables to restrict the records between 01/09/2016 and 04/09/2016 it returns records between 09/01/2016 and 09/04/2016.
However if enter the dates directly using the American setting #09/01/2016# and #09/04/2016# I get the expected set records over the 4 days.
Any assistance would be very welcome.
Andrew