Access with SQL server, VBA and uk and US dates

mackyrm

Registered User.
Local time
Today, 01:57
Joined
Oct 5, 2006
Messages
57
I am trying to generate a query based on dates input by the users in a text box with an input mask, and users will input dd/mm/yyyy. I am using an access front end on an sql server. The server is read only.

I am using VBA and DAO to generate the records and query.

I am having a problem with dates and it is essentially is due to the SQL server date format. I can query using US style dates on input, but not UK format.

I have my code referencing dates here, I have tried format() and cdate(), with no success. Could anyone advise if there is another way of doing this?

mySQL = mySQL + vbCrLf & " ((format([Product].[Startdate], 'dd/mm/yyyy'))>=#" & txtFrom & "#)"
 
Thank you for this. Formatting input into the US format before comparison worked.
 

Users who are viewing this thread

Back
Top Bottom