Problem with Dlookup with 2 criteria

  • Thread starter Thread starter SF
  • Start date Start date
S

SF

Hi,

I am trying to get the Document path from a table through Dlookup. Dlookup
always return null


On Error GoTo Err_btnPrintProject_Click:
Dim DocPath As String

DocPath = DLookup("DocLink", "tblDocuments", "[DocCategory]='Application'
and [DocObjectID]=" & Me.ID)
MsgBox DocPath

Exit_btnPrintProject_Click:
DoCmd.Hourglass False
Exit Sub

Err_btnPrintProject_Click:
If Err.Number = 94 Then
MsgBox "File not found or link has not been set", vbOKOnly +
vbInformation
Else
MsgBox Err.Number, vbOKOnly + vbInformation
End If
Resume Exit_btnPrintProject_Click:

SF
 
Are you sure Me.ID is returning the correct value? Are you sure that
DocCategory really contains Application? (The reason I'm asking the latter
is because if you used the Lookup Wizard with DocCategory, it doesn't
actually contain what appears when you qiuery it)
 
Back
Top