Hi
I have an input box with input mask for two dates as dd/mm/yyyy which I pass as variables to several SQL queries in VBA. When the date is, for example, 17th November the date is passed as 11/17/2002 (correct for SQL) but 1st November is passed as 01/11/2002. Both dates are treated in the same way using the following
datStart = Format(txtStartDate.Text, "DD/MM/YYYY"
datEnd = Format(txtEndDate.Text, "DD/MM/YYYY"
I have tried passing as strings
strStartDate = left(datStart,2) & "/" & mid(datStart,4,2) & "/" & right(datStart,4)
but I still can't get dates before the 12th of the month to pass correctly. What simple thing am I doing wrong???
Thanks for your help
I have an input box with input mask for two dates as dd/mm/yyyy which I pass as variables to several SQL queries in VBA. When the date is, for example, 17th November the date is passed as 11/17/2002 (correct for SQL) but 1st November is passed as 01/11/2002. Both dates are treated in the same way using the following
datStart = Format(txtStartDate.Text, "DD/MM/YYYY"
datEnd = Format(txtEndDate.Text, "DD/MM/YYYY"
I have tried passing as strings
strStartDate = left(datStart,2) & "/" & mid(datStart,4,2) & "/" & right(datStart,4)
but I still can't get dates before the 12th of the month to pass correctly. What simple thing am I doing wrong???
Thanks for your help