Dlookup Function

C

Curt Hand

I have put and event function on the Lost Focus of one of my fields in a form
and it will not work. The following is the code:
Private Sub CustomerNumber_LostFocus()
ClientName = DLookup("CompanyName", "tblClients", "CustomerNumber='" &
[CustomerNumber] & "'")

End Sub

When I hit the tab button I get a Run-time error '3464'

I have looked up the error and I can't figure out what the problem is.
The tblClients.CustomerNumber is an auto number type and the forms
[CustomerNumber] is a number type.

Your help is greatly appreciated.
Thanks,
Curt Hand
 
D

Duane Hookom

Ditch some of the quotes:
ClientName = DLookup("CompanyName", "tblClients", "CustomerNumber=" &
[CustomerNumber] )
 
C

Curt Hand

Thanks Duane you are always a great help. It works great.

Duane Hookom said:
Ditch some of the quotes:
ClientName = DLookup("CompanyName", "tblClients", "CustomerNumber=" &
[CustomerNumber] )

--
Duane Hookom
MS Access MVP
--

Curt Hand said:
I have put and event function on the Lost Focus of one of my fields in a
form
and it will not work. The following is the code:
Private Sub CustomerNumber_LostFocus()
ClientName = DLookup("CompanyName", "tblClients", "CustomerNumber='" &
[CustomerNumber] & "'")

End Sub

When I hit the tab button I get a Run-time error '3464'

I have looked up the error and I can't figure out what the problem is.
The tblClients.CustomerNumber is an auto number type and the forms
[CustomerNumber] is a number type.

Your help is greatly appreciated.
Thanks,
Curt Hand
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top