using variable name in lookup

lcline

Registered User.
Local time
Today, 15:30
Joined
Oct 23, 2001
Messages
53
Please Help me understand how to use the varible SizeHdr in a Dlookup.

I get the message of data type mismatch.
The column RollSize is of type text!

Select Case SizeDeterminer
Case Is >= 270
SizeHdr = 270
Case 80 To 269
SizeHdr = 80
Case Else
MsgBox ("You will have to do a manual entry as order size is too small!")
End Select

DealerPrice = DLookup("[RollCost]", "Products", "[Product Name] = cmbProdName And [RollSize] = " & CStr(SizeHdr))
 
Try this:

DealerPrice = DLookup("[RollCost]", "Products", "[Product Name] = cmbProdName And [RollSize] = '" & CStr(SizeHdr) & "'")

Strings are usualy held in single quotes numbers no quotes

HTH
 
Last edited:
I'm not sure. I dim"ed" SizeHdr as Variant

I keep playing with the code and finally found out what I was doing wrong. I wrapped the variable SizeHdr like this and it worked!

Thanks for your quick response though!!!!!!!!

[RollSize]= '" & SizeHdr & "'"
 

Users who are viewing this thread

Back
Top Bottom