I thought I had Dates in Access figured out but this has floored me!
I understood dates in SQL have to be #MM/DD/YYYY# (and single M or D is also okay).
This function swaps Day and Month to suit SQL and has worked fine until a Date of 17 Oct.
If d is 17/10/1987, USDate stays 17/10/1987 as if the split and reassignment are completely ignored.
Then, the non_US date returns a correct result from the SQL query.
Is it because 17 is > 12 and so must be the Day? Meaning it is NOT true that sql must be formatted #MM/DD/YYYY# ?
I understood dates in SQL have to be #MM/DD/YYYY# (and single M or D is also okay).
This function swaps Day and Month to suit SQL and has worked fine until a Date of 17 Oct.
Code:
Private Function USDate(d) As Date
Dim c
c = Split(d, "/")
USDate = CDate(c(1) & "/" & c(0) & "/" & c(2))
End Function
Then, the non_US date returns a correct result from the SQL query.
Is it because 17 is > 12 and so must be the Day? Meaning it is NOT true that sql must be formatted #MM/DD/YYYY# ?