Running Query from Button Using drop down list

stu_c

Registered User.
Local time
Today, 07:49
Joined
Sep 20, 2007
Messages
494
Hello all
I will try and explain what I am trying to do.
I currently have a list of companies in a drop down list on a order form, what I want to try and do is choose the company for example "Screwfix" from the drop down list, then click a button to show all previous orders for screwfix in a query.

I currently have a query to do this using parameters but would be very helpful if I could just click a button and uses the dropdown list selection rather than typing it in.

I think its fairly simple to do but been racking my brain and cant solve it :(
 
post the sql for your query and the name of your combobox.
you just need to reference the combobox in your query where you have the parameter.
 
in a detail form, select the client, in the AFTERUPDATE event of the combo
filter the master form on the combo ID
Code:
sub cboClient_Afterupdate()
me.filter = "[ID] = " &  cboClient
me.filterON = true

now all the Client data shows in the master form.
then the master form has a subform for sales
this is linked to the masterform ID so it will ONLY show data belonging
to that client.
 
Thanks for the advice Ranman, how will the code know to look into the correct query?

below is the names of each.

Drop Down List - DDLCompanies
Button name - BTNCompanyItems
Query Name: QRYCompanyItems
 

Users who are viewing this thread

Back
Top Bottom