DLookUp issue

hllary

Registered User.
Local time
Yesterday, 22:24
Joined
Sep 23, 2019
Messages
80
I have a text box on a form that looks up the number of vehicles in another table. there is only one value in the table.

Code:
=DLookUp("Number of Vehicles","NumberOfVehicles","[Number of Vehicles]=" & [Me]![Text66])

Number of Vehicles is the column name
NumberOfVehicles is the table name
Text66 is the textbox name

the textbox returns #Name?

What's causing the problem?
 
Is [Number of vehicles] a number or a number stored as text?
Also use I think you would have to use simply
Code:
= Text66
I don't think within a form control you can reference Me
 
Last edited:
Is [Number of vehicles] a number or a number stored as text?
Also use I think you would have to use simply
Code:
= Text66
I don't think within a form control you can reference
The [Number of vehicles] is stored as text. I tried = Text66 and I still got #Name?
 
Hi Hillary. What do you get if you simply tried it this way?
Code:
=DLookUp("Number of Vehicles","NumberOfVehicles")
 
I get #Error
Okay, one more try:
Code:
=DLookUp("[Number of Vehicles]","NumberOfVehicles")
Please note the addition of the square brackets around the field name.
 
Okay, one more try:
Code:
=DLookUp("[Number of Vehicles]","NumberOfVehicles")
Please note the addition of the square brackets around the field name.
It work!!! thank you
 
It work!!! thank you
Hi. You're welcome. Glad to hear that worked for you. You might consider avoiding using spaces in your field names to avoid issues like this in the future. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom