Using Combo Box to pass value to query

Rik_StHelens

Registered User.
Local time
Today, 04:30
Joined
Sep 15, 2009
Messages
164
Hi,

i have created an unbound form which has a combo box listing our fleet customers. There are 3 buttons on the form which run 3 different reports. Each query upon which the reports are based, has the following SQL statement in it:

WHERE (((tblVehicle.Customer)=[Forms]![Fleet Management Menu]![CustName]))

However, when i run a report, it comes back blank as it is not taking the value from the combo box. This is the first time i have tried this, and i have probably missed something glaringly obvious.

Any help is greatly appreciated.

Thanks!
 
Since you are working with text values, my immediate thought is that you need quotes around your CustName.

WHERE tblVehicle.Customer = ' " & [Forms]![Fleet Management Menu]![CustName] & "'"
However, you do need to make sure you are referencing the selected value in the combobox. What is the name of the combobox?
Can you show us a little more of your SQL?
 
I have sorted it now

When i created my combo box it asked mt to name it...but it names the label!

So i was referencing the label! oops....

i checked just in case as you had asked for combo box name

and it doesnt seem to matter about the quotes by the way.

Thanks!
 

Users who are viewing this thread

Back
Top Bottom