DLookup w/ "and" statement

  • Thread starter Thread starter bill
  • Start date Start date
B

bill

The following piece of code is generating a "Type
Mismatch" error. What I'm not sure about is using
an "And" statement within the DLookup function (next to
last line). Does anyone see a problem here?


Dim strBeg As String, strMiddle As String, strEnd As
String, strFull As String, strOrder As String

strOrder = "[ORDER_NUMBER]=" & Me!OriginalInvoice
strBeg = "B"
strMiddle = Me!ItemCode

If Me!Size = "XL" Then
strEnd = "6"
End If

If Me!Size = "2XL" Then
strEnd = "7"
End If

If Me!Size = "3XL" Then
strEnd = "8"
End If

strFull = "[ITEM_NUMBER]='" & strBeg & strMiddle &
strEnd & "'"

Me!Price = DLookup("PRICE", "dbo_ORDER_DETAIL",
strOrder And strFull)

End Sub
 
I'm having a hard time figuring out what your code is supposed to be doing,
but I think the following should work:

Me!Price = DLookup("PRICE", "dbo_ORDER_DETAIL", strOrder & " And " &
strFull)
 
Back
Top