Dlookup syntax with number variable and date ()

latex88

Registered User.
Local time
Today, 04:52
Joined
Jul 10, 2003
Messages
198
Needing help with syntax involving a number type variable and date () as conditions.

Below does work for me.
dlookup ("MyField", "MyTable", "MyField2" = & numVariable1 and MyField3 = date () )
 
I always refer to 'DLoopUp Usage Samples', for getting this right.. The result should be something along the lines of..
Code:
DLookUp("yourField", "yourTableName", _
        "yourNumberField = " & numVar [COLOR=Red][B]& "[/B][/COLOR] AND yourDateField =[COLOR=Red][B] #" &[/B][/COLOR] Date()[COLOR=Red][B] & "#"[/B][/COLOR])
 
Thank you Paul. Your code worked beautifully.
 
Paul,
I tried to refer to the link you gave me to come up with the syntax for the below scenario with three conditions, but keep failing. I'd appreciate it if you can help me again.

DLookUp("MyField", "MyTableName", "MyNumericField = " & numVar AND "MyTextField = 'No'" AND MyDateField = #" & dateVar & "#")
 
You missed a concatenation operator after the numVar and added a double quote after AND whihc is not required.. So change it as..
Code:
DLookUp("MyField", "MyTableName", "MyNumericField = " & numVar [COLOR=Red][B]& " [/B][/COLOR]AND MyTextField = 'No' AND MyDateField = #" & dateVar & "#")
 
Thank you, thank you. I just can't seem to get it.
 
Hello Latex88, just remember this.. Any variable needs to be concatenated with the Criteria.. If they are direct values like 'No' in the above statement, then it does not have to.. just variables, by using the ampersand operator.. Joining many criteria would be tricky at times, but you will get the hang of things, as times goes on.. :)
 

Users who are viewing this thread

Back
Top Bottom