null and dlookup

sven2

Registered User.
Local time
Today, 15:25
Joined
Apr 28, 2007
Messages
297
Hello,

what is the most easy way to prevent an error with a null value in a dlookup?

I have an field on a form that sometimes is = 0 then I get an error in the following code:

DLookup("[Date]", "Tblusers", "[user] =" & Me.lastuser & "")

Is it possible that when lastuser = 0 the text "no date" should appear and in the other case the value of dlookup?

I tried it like this:

If Not IsNull(Me.Laatsteingavefreq2) Then
Me.laatstedatumfreq2 = DLookup("[Datum]", "TblMoederrollen", "[Moederrolnummer] =" & Me.Laatsteingavefreq2 & "")
Else
Resume Next
End If

But I get an error in the resume next

Thanks in advance,
Sven.
 
Last edited:
Put the NZ function around it:

NZ (DLookup....etc.,0)
 

Users who are viewing this thread

Back
Top Bottom