DLookup's criteria

J

juicegully

Hello!

I'm trying to use DLookup to return a date if it falls within a certain
range and so far it doesn't work. Can someone please tell me what's wrong?

Here's my code:
txtNewDate = DLookup("[Date]", "tbQOL", "[PatientID]='" & TheID & "' AND
[Date] >= " & DateMin & " AND [Date] <= " & DateMax)

It seems to output a value if I take out one of the Date criteria but it
doesn't work when I have to compare it against both DateMin and DateMax.

Thanks in advance.
 
J

juicegully

I think I just solved my own problem. I needed "#" symbols on either side of
the DateMin and DateMax.
 
Top