Make #Name? Disappear

wjoc1

Registered User.
Local time
Today, 07:54
Joined
Jul 25, 2002
Messages
117
Hi,

I have some comboboxes with DLookup functions in them. The DLookups use values from other comboboxes on the form. However sometimes these are not filled in and as a result the combobox containing the DLookup comes up with "#Name?" or some error.

Is there anyway I can set this to null and have the combobox come up blank when theDLookup returns an error?

Thanks,
Liam
 
Liam,

You can assign the return value of the DLookUp to a variant and
then check it for a Null value.

Code:
Dim srchResult As Variant

srcResult = DLookUP("some DLookUp stuff")

If IsNull(srchResult) Then
   MsgBox("The DLookUp returned nothing.")
   Exit Sub
End If
'
' Then move it a textbox on the form here.
'

Wayne
 

Users who are viewing this thread

Back
Top Bottom