Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLookup Help

Status
Not open for further replies.
Sep 19, 2002
34
US
Question regarding return value from DLookup.. The help states that DLookup will return NULL if no data is returned.

I have used the example: dim varx as Variant and then checked varx for NULL value. I can't seem to get the check to work. I want to direct the user to renter a correct value in the event of NULL.

Can anyone shed some light on the proper evaluation of varx being a null value.

Thanks




 
Should you be using DLOOKUP at all? Can't you just code..

If IsNull(varx) Then
MsgBox "Whoops...", vbExclamation
End If


AIRC DLOOKUP looks up a value in a table...and isn't very efficient at that either :)
 
Thanks for the repsonses.
John here is what I am doing.
Dim Varx as variant
varx = DLookup("[Name]","Database","[Id]='" &
Code:
 & '"

The DLookup returns the value i'm tryimg to find.
I wanted to do some error checking and changed it to the code included here.

I can't seem to have it fall into the If NULL condition.
 
Kevinf2349

I was checking for If varx = null then...

I tried the if isnull(varx) and that solved it.

thanks to both for your effort to Help ME!!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top