using a combo box to input criteria into a query

John thomas

Registered User.
Local time
Today, 12:23
Joined
Sep 4, 2012
Messages
206
Advise please
I have a customers list that i am always ading to .I need to run a query to see what individual customers have ordered .
I have the query that works great when i manually insert the customers Surname .but i want the combo to do this job .Is it possible ,or should i be doing something different .
 
Hello John thomas,

Create a Form that will have a ComboBox (call it surnameCombo) that will list all the Customer's surnames from the customer table.. Its RowSource being something like..
Code:
SELECT DISTINCT tableName.SurName FROM tableName;
Then create(change) your query as..
Code:
SELECT orderTable.* FROM orderTable WHERE orderTable.surName = Forms!yourCreatedForm!surnameCombo;
And then you can run the Query from the Form maybe after a button click..
Code:
Private buttonOnFormName_Click()
    DoCmd.OpenQuery "yourCreatedQueryName"
End Sub
 

Users who are viewing this thread

Back
Top Bottom