Dlookup not showing result

sbaud2003

Member
Local time
Tomorrow, 00:03
Joined
Apr 5, 2020
Messages
186
Hi I am very new to access.. and I using the code below which returns only one result
TXTUTR=Dlookup("utr_number", "ecs", " payment_sl_no=forms! Formamount! COMPMT and forms! Formamount! COMFY)
 
Your syntax is incorrect.

Can you explain your criteria.
At the moment you appear to want a record where "payment_sl_no" equals both "COMPMT" AND "COMFY". That will only happen if they are both the same. Perhaps you meant OR.

Also, what is the Data Type of the field called "payment_sl_no".
 
Also a DLookup will only return one result, the first one it finds.?

As Bob stated, you probably mean OR but even then it should be

Code:
TXTUTR=Dlookup("utr_number", "ecs", "payment_sl_no=forms!Formamount!COMPMT OR payment_sl_no= forms!Formamount!COMFY")

HTH
 
Thanks all of you
Yes the result should be one record only.
But when payment_sl_no gets changed the value does not change.
It is a numeric field and controlled thorough a combo box and COMFY is the financial year again a numeric field through combo
 
After update event of the changed field/record/form:

me.dlookupfieldname.requery
 
If the values come from a combo are you sure the bound value is not numeric? That would be the normal situation. So you wouldn't be looking for

Somefield = "COMPMT" OR Somefield = "COMFY"

You would be looking for

Somefield = 987 OR Somefield = 123

Using of course the actual numerical values that correspond with the two strings.
 

Users who are viewing this thread

Back
Top Bottom