Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dlookup with multiple criteria

Status
Not open for further replies.

DriesG

Programmer
Jul 2, 2003
16
0
0
BE
Hey,

I have a dlookup function for an unbound textbox. Th problem is that the function doesn't return the correct value. This is my syntax:

DLookUp("[Available]";"tblPlanning";"[Name] =" & [txtName] & " And [Date] =" & [txtDate])

The controls "Name" are numeric and the controls "Date" are Date/Time

The syntax should be correct for a multiple criteria, but it doesn't work. Is it because I use a Date/Time control as a criteria? Normally a Date/Time criteria should be between #date#

Does anybody know how I should write the criteria?

Thanks for your help.

Best regards,
Dries
 
Hi,

This should do it:

DLookUp("[Available]","tblPlanning","[Name] =" & [txtName] & " And [Date] =#" & [txtDate] & "#")

John
 
Hello John,

Thank you for your help, but I tried that already. It didn't work. I thought already the error had to be in the date/time criteria.
But anyway, thanks to you it just came to me. I was looking at your syntax and I saw the problem.

I use the European date notition as I'm living in Belgium.
So the tenth of Januar for me = 01/10/03.
But if you use this in a criteria, you must enter 10/01/03.
VBA uses American date notition.

Once again, it was a stupid little thing that can give you hours of frustration ...

thanks again,
Dries
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top