DLookUp issue (1 Viewer)

hllary

Registered User.
Local time
Yesterday, 19:20
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?
 

Minty

AWF VIP
Local time
Today, 03:20
Joined
Jul 26, 2013
Messages
10,371
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:

hllary

Registered User.
Local time
Yesterday, 19:20
Joined
Sep 23, 2019
Messages
80
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?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:20
Joined
Oct 29, 2018
Messages
21,504
Hi Hillary. What do you get if you simply tried it this way?
Code:
=DLookUp("Number of Vehicles","NumberOfVehicles")
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:20
Joined
Oct 29, 2018
Messages
21,504
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.
 

hllary

Registered User.
Local time
Yesterday, 19:20
Joined
Sep 23, 2019
Messages
80
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
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:20
Joined
Oct 29, 2018
Messages
21,504
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

Top Bottom