B
bobbeed
Can anyone please explain to me, in simple terms(I am on the limit of
what I understand with this question) why the first will work, but the
second will not.
WORKS
Private Sub Command1_Click()
Dim varX As Variant
varX = DLookup("[CompanyName]", "Shippers", "[ShipperID] = 2")
MsgBox varX
End Sub
DOESN'T WORK
Private Sub Command1_Click()
Dim varX As Variant
Dim intNumber As Integer
intNumber = 2
varX = DLookup("[CompanyName]", "Shippers", "[ShipperID] = intNumber ")
MsgBox varX
End Sub
The second stops with the following message:
Runtime error 2471:
The expression you entered as a query parameter produced this error:
'The object doesn't contain the Automation object 'intNumber'.
what I understand with this question) why the first will work, but the
second will not.
WORKS
Private Sub Command1_Click()
Dim varX As Variant
varX = DLookup("[CompanyName]", "Shippers", "[ShipperID] = 2")
MsgBox varX
End Sub
DOESN'T WORK
Private Sub Command1_Click()
Dim varX As Variant
Dim intNumber As Integer
intNumber = 2
varX = DLookup("[CompanyName]", "Shippers", "[ShipperID] = intNumber ")
MsgBox varX
End Sub
The second stops with the following message:
Runtime error 2471:
The expression you entered as a query parameter produced this error:
'The object doesn't contain the Automation object 'intNumber'.