Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Access Q and A _ Dlookup

Posted by: mike60smart Oct 19 2019, 12:30 PM

Hi Everyone

The following DLookup is returning no value when it should return one.

Can anyone spot where I am wrong?

Any help appreciated

=DLookUp("Balance","tblStudentFeeCollection","[StudentID] = " & [StudentID] And [MonthID]=" & [MonthID] & ")

Posted by: pere_de_chipstick Oct 19 2019, 12:37 PM

Hi Mike
Check your quote marks;
"StudentID = " & [StudentID] & " AND [MonthID] = " & [MonthID])

HTH

Posted by: tina t Oct 19 2019, 12:38 PM

hi Bob, control references must always be outside the string(s) in the criteria argument, hon, as

=DLookUp("Balance","tblStudentFeeCollection","[StudentID] = " & [StudentID] & " And [MonthID]=" & [MonthID])

the above assumes that both fields StudentID and MonthID are Number data types in tblStudentFeeCollection. if they're Text data types, the syntax would be

=DLookUp("Balance","tblStudentFeeCollection","[StudentID] = '" & [StudentID] & "' And [MonthID] = '" & [MonthID] & "'")

hth
tina

EDIT: ha, Bernie beat me to it. hi, Bernie! :)

Posted by: mike60smart Oct 19 2019, 01:40 PM

Hi Bernie

Spot on yet again

Many thanks to both yourself and Tina

cheers.gif
pompom.gif

Posted by: pere_de_chipstick Oct 20 2019, 09:26 AM

yw.gif

Tina and I are always pleased to help.

Hi Tina wavehi.gif
I may have beaten you to it, but you gave the fuller answer thumbup.gif !