Date Select statement not working from 01/10/2004

G

Guest

The following query worked until today. My date format is ShortDate
(dd/mm/yycc)
The value returned from the table is 01/10/2004 and the value in the textbox
is 01/10/2004.

QryCurRA = "SELECT * From RA Where (RA_System_LU) = 1 And (RA_DateReceived)
= " + "#" + Str(Tbx_RA_DateReceived.Value) + "#" + " And (RA_TimeReceived) =
" + "#" + Str(Tbx_RA_TimeReceived.Value) + "#" + ""

If I run a query and put the date in as 10/01/2004 (10 jan 2004) then is
select the data from the 1st October. When I enter data into my table for the
10/01/2004, it does not select October anymore and my query returns Null.

How do I go about resolving this?
 
G

Guest

Thanks

Changed my regional setting for date to dd/MMM/yyyy and I am up and running
again.
 
D

Douglas J. Steele

Glad you got it going, but recognize that all you did was relieve the
symptom, not fix the problem.

Should your application be used by someone else, you'll run into the same
problem, and, in my opinion, forcing the user to change his/her regional
settings is NOT an acceptable solution.

A more generic solution would be:

QryCurRA = "SELECT * From RA Where (RA_System_LU) = 1 And (RA_DateReceived)
= " & Format(CDate(Tbx_RA_DateReceived.Value), "\#mm\/dd\/yyyy\#") & " And
(RA_TimeReceived) =" &
Format(CDate(Tbx_RA_TimeReceived.Value),"\#mm\/dd\/yyyy\#)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top