Recordset Findfirst Date Issue

Joined
Mar 29, 2013
Messages
1
Reaction score
0
Hi, i would need some help with Findfirst and dates.

My systems locales are following:
Short Date ‎29. ‎3. ‎2013
Short Date d. M. yyyy

My code does the following.

I have a table "predaj" where I store invoice information like id, date, time, ...
I am using recordset to store values that i read out of a file.
I need later to find a specific invoice by date and time and update some parameters.

Dim predaj As DAO.Recordset
Dim sdate, stime As Date

To store the new value works fine with following
predaj.AddNew
predaj![date] = sdate
predaj![time[ = stime

when i debug it and check in local the values those seem OK
e.g.
sdate : #1. 3. 2013# : Date
stime : #10:31:50# : Date

also when i hover the cursor over the variable is shows OK
sdate = 1. 3. 2013
stime = 10:31:50

But when if try to search for a value I am getting always an error (Run-time error '3077': Syntax error in date expression." no matter what syntax for Findfirst i use

predaj.FindFirst "date = " & Format(sdate, "Short Date")
predaj.FindFirst "Datum = #" & Format(sdatum, "Short Date") & "#"
predaj.FindFirst "date = #" & sdate & "#"
predaj.FindFirst "date = " & Format(sdate, "\#d. m. yyyy\#")

For time however the Findfirst works

predaj.FindFirst "[Cas] = #" & stime & "#"

I have read a lot of threads already but i am unable to figure out what is wrong in my case.
Please help, suggest what i can do.
Thanks
 

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