Error on Dlookup

mafhobb

Registered User.
Local time
Today, 16:06
Joined
Feb 28, 2006
Messages
1,249
I am getting a "type mismatch 13" error on this line
Code:
        PrinterSel = Nz(DLookup("Device", "tblPrinterSelection", "Doc='" & DocumentType & "'" And "Computer='" & sHostName & "'"), "No Printer")

All vba variables are defined as strings. All fields in the table are text.

mafhobb
 
Solved it. It was a syntax issue.
Code:
        PrinterSel = Nz(DLookup("Device", "tblPrinterSelection", "Doc='" & DocumentType & "'" & "And Computer='" & sHostName & "'"), "No Printer")
This did it.

mafhobb
 
Good to hear!

If in doubt, Debug.Print the string and you'll be able to spot any syntax errors.
 

Users who are viewing this thread

Back
Top Bottom