I've been looking for hours...

hbrems

has no clue...
Local time
Today, 14:37
Joined
Nov 2, 2006
Messages
181
Can you figure out what's wrong with this code? I want to retrieve the ID that matches the date...

vchecklist = DLookup("fldchecklistid", "tblchecklist", "flddate = " & "#" & Me.txtdate & "#")
msgbox vchecklist

Kind regards,
Hans
 
if its a uus/uk date issue wrap the date with format(txtdate,"long date")
 
I'm not sure if that's the problem. But somehow I can't see anything else being wrong with the code. This is really frustrating me now as it is holding me back to continue on my project...
 
Have you tried adjusting your code to US dates?
 
The code looks like this now :

Const JetDateTimeFmt = "\#mm\/dd\/yyyy hh\:nn\:ss\#;;;\N\u\l\l"
Const JetDateFmt = "\#mm\/dd\/yyyy\#;;;\N\u\l\l"
Const JetTimeFmt = "\#hh\:nn\:ss\#;;;\N\u\l\l"

vcheck = DLookup("fldchecklistid", "tblchecklist", "flddate = " & "#" & Me.txtdate & "#")
MsgBox vcheck

I don't know how to refer to the new formats in my Dlookup though. Thanks for the replies so far.
 
Hey guys, I solved the problem :)

Here's what I needed:

vcheck = DLookup("fldchecklistid", "tblchecklist", "flddate = #" & Format(Forms![frmmain]![txtdate], "yyyy-mm-dd") & "#")

Thanks for the swift replies, turns out you guys were right ;-)
 
Outstanding! Thanks for posting back with your success.
 

Users who are viewing this thread

Back
Top Bottom