G
Guest
Hi
I am trying to get a dlookup statement to return a value and get the error
message 'Runtime error 2001 you canceled the previous operation. Iknow the
syntax is correct because it works against a tbale where I look up the
county. It does not work against the companies table. I have tried it in the
immediate window and this is the error message I get. What I cant understand
is how it works on one line but not the next.
Code extraxt:
strCounty = DLookup("[County]", "[tblCounties]", "[ID] =" & Me.cboCounty)
If Me.cboCompanyName <> 0 Then
strCompany = DLookup("[Company Name]", "[tblCompanies]",
"[CompanyID] =" & _
Me.cboCompanyName)
End If
I am trying to get a dlookup statement to return a value and get the error
message 'Runtime error 2001 you canceled the previous operation. Iknow the
syntax is correct because it works against a tbale where I look up the
county. It does not work against the companies table. I have tried it in the
immediate window and this is the error message I get. What I cant understand
is how it works on one line but not the next.
Code extraxt:
strCounty = DLookup("[County]", "[tblCounties]", "[ID] =" & Me.cboCounty)
If Me.cboCompanyName <> 0 Then
strCompany = DLookup("[Company Name]", "[tblCompanies]",
"[CompanyID] =" & _
Me.cboCompanyName)
End If