Solved How to hide the #error in an unbound DLookup field

brandywinefarm

New member
Local time
Today, 03:47
Joined
Jan 27, 2023
Messages
4
Hello.
I have a form that has a drop down box that looks up the referrerID from a contact table (integer).
Then I have an unbound field that reports that person's name for the user.
It works fine. However, if there is no one that referred that client, the referrerID field is null and so the unbound field shows "#error".
Control source for that unbound field =DLookUp("[FirstName] & ' ' & [LastName]","people","peopleid=" & [frmReferrerID])
Is there any way I can hide this text so the data entry person doesn't get confused by this #error?
I have searched and tried a few code snippets but nothing seems to work.
 
try:

=DLookUp("[FirstName] & ' ' & [LastName]","people","peopleid=" & Nz([frmReferrerID],0)) & ""
 
That works. Please help me understand. Before I tried to use ISNULL to return a "" into the field but it never worked.
Isn't it proper to use ISNULL on a blank integer field?
 
Stated another way, the NZ function "hides" the actual ISNULL test behind the scenes and performs the substitution if ISNULL would be TRUE. By hiding the test, NZ lets you make a safer operation that will avoid the pitfalls of null encounters.
 

Users who are viewing this thread

Back
Top Bottom