Combo box not passing Parameter to query

iainmid

Registered User.
Local time
Today, 10:41
Joined
Mar 1, 2007
Messages
35
I am having a problem using a combo box to pass over a parameter for my query. My query does not seem to be picking up the value from the combo box on the form.
I have created a Contacts table within that there is a field City as a text box so the user can imput any value.
I've created CityReport form which has a combo box that uses a select statement to pull out all the values from Contacts.City so that you can select them drop down in the combo box. I don't know if because these values aren't stored that there not being passed into my query when i run it.
My query is on CityReport form to run a report is Select * from Contact where City = forms.[CityReport].[City]
 
Have you tried
Code:
SELECT * FROM Contact WHERE City = forms[COLOR=Red][B]![/B][/COLOR][CityReport][COLOR=Red][B]![/B][/COLOR][City]
 
Yeah i have tried that. Here is an example of what i have done on the form when you select nottingham from the combo box the report still runs as if you have selected Leicester
 

Attachments

Howzit

You have:
  • A combo box control called Combo0 not City - therefore change your reference in your query. Remember when referencing controls on the form, reference the Name of the control, not the name of the field.
  • Your form is bound to the table Contacts - make it unbound - so you only have one record in the navigation buttons
  • only have one column for your combobox - which should be your city field

Check db attahced
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom