Dlookup and multiple criteria error

Marcel2586

Registered User.
Local time
Today, 07:57
Joined
Mar 1, 2012
Messages
41
I have a problem with my dlookup statement. When i run it separately there are no errors and I get my results but when I combine them together with AND I get error runtime error ‘13’: Type mismatch.
All tables are text.

This is the code that works


Code:
DestTAT = DLookup "[TAT]", "tbl Dest TAT", "[MAT]= '" & MatStr & "'"
Code:
DestTAT = DLookup "[TAT]", "tbl Dest TAT", "[Destination]= '" & Znumber1Str & "'"

This gives the error
Code:
Public Function DestTAT(MatStr As String, Znumber1Str As String) As Variant
 
    DestTAT = DLookup("[TAT]", "tbl Dest TAT", _
    "[MAT]= '" & MatStr & "'" And "[Destination]= '" & Znumber1Str & "'")
End Function

Thanks in advance
 
Try this:
....... MatStr & "'" & "And [Destination]= '" & Znumber1Str & "'")
 
Many and many thanks.
You saved the day. (mine at least)
 

Users who are viewing this thread

Back
Top Bottom