Runtime error 13 on DLookup (1 Viewer)

lightray

Registered User.
Local time
Tomorrow, 05:36
Joined
Sep 18, 2006
Messages
270
Hi, after resourcing my Runtime 3075, I've now backed into this one.
I'm trying to check a condition that a user has a previous certificate type and then pop the User to show the condition. Print is a yes/no field, ID fields are numeric. Have I got this right? Appreciate any help it's almost 2am here..

Code:
    stDocName = "frmTrainee"
    stLinkCriteria = "[TraineeID]=" & Me![TraineeID]
    
    If CertTypeID = 2 Then
        Answer = DLookup("[CertTypeID]", "[tblCertificate]", "[TraineeID]= " & Me.TraineeID _
        & " And [CertTypeID] = 1" _
        And [Print] = -1)
            If Not IsNull(Answer) Then
            MsgBox "Standard Certificate exists.", vbOKOnly, "Standard"
            DoCmd.OpenForm stDocName, , , stLinkCriteria
            End If
    End If
 

RuralGuy

AWF VIP
Local time
Today, 11:36
Joined
Jul 2, 2005
Messages
13,826
You left out some quotes:
Code:
Answer = DLookup("[CertTypeID]", "[tblCertificate]", "[TraineeID]= " & Me.TraineeID _
        & " And [CertTypeID] = 1" _
        [b][COLOR="Red"] & " [/COLOR]And [Print] = -1[COLOR="Red"] "[/COLOR])[/b]
 

lightray

Registered User.
Local time
Tomorrow, 05:36
Joined
Sep 18, 2006
Messages
270
Hey RuralGuy, as usual that is awesome spotting.. many thanks. It worked amazingly well. I looked at so many examples on the site, I just couldn't spot it. Probably the 2 am thing.. :):):)
 

RuralGuy

AWF VIP
Local time
Today, 11:36
Joined
Jul 2, 2005
Messages
13,826
Another pair of eyes is sometimes helpful.
 

Users who are viewing this thread

Top Bottom