Format date problem

Carl_R

Registered User.
Local time
Today, 09:37
Joined
Aug 16, 2002
Messages
82
Checked the numerous posts about this but still having probs...

stSQL = stSQL & " WHERE tblChanges.ImplementationDate Between #" & Format([txtFrom], "dd/mm/yyyy") & "# And #" & Format([txtTo], "dd/mm/yyyy") & "#;"

I want the user to be able to enter the date in format dd/mm/yyyy to retrieve their records, which are output to a report.

Records are not being found, unless the user enters the US format of mm/dd/yyyy.

Any suggestions welcome.
 
You have to format dates in strSQL as US format
stSQL = stSQL & " WHERE tblChanges.ImplementationDate Between #" & Format([txtFrom], "mm/dd/yyyy") & "# And #" & Format([txtTo], "mm/dd/yyyy") & "#;"
will allow users to enter dates as dd/mm/yyyy
 
Have you checked the regional settings control panel ?

If the date format is specified as DD/MM/YYYY then you can use
18/09/02 or 18/09/2002

however if the date format US (MM/DD/YYYY) then it will only work if you use enter 18/09/2002

Smed
 
Date format prob fixed.

Thanks Rich. You are indeed a legend :) My records are no longer lost.

On the topic of regional settings, these were already changed to 'dd/mm/yyyy'. The problem is with SQL in VB.

Straight from the MS Access help:
You must use English (United States) date formats in SQL statements in Visual Basic.

I should learn to read :)
 

Users who are viewing this thread

Back
Top Bottom