Run a query from a form and display results in list box?

kargil0903

New Member
Joined
Feb 17, 2003
Messages
2
I am creating a form in Access. After I select from a combo box in my form, I need to run a query that uses my combo box selection as the criteria in the query and then displays the results of the query in list box in another field within the form. Can anyone help me how to do this? Thanks.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I don’t know if this is what you want (or if it will work) but here goes what I would try.

Lets call the first combo box combo1 in form1
The combo box would have something in row source like
SELECT DISTINCTROW [supplier].[name] FROM [supplier];

There are two ways I can think to do the next bit. I’ll assume the form is still going to be open.
You write the query that has a criteria
WHERE name=[forms].[forms1].[combo1] and select the list of things you want eg products

Now base the second combo on that query that finds products.
========

The other option is to have a table behind the form with a single entry (you set the fields on the form so that you can edit records but not add. If you do this then you wouldn’t need to keep the form open and could use a reference to the table behind the form
 
Upvote 0
Ifonly, thanks for your help but I need a bit more of assistance. Can you plese help me with the syntax. My form name is DailyAuditScoreForm. My combo box1 is referencing the AREA field from a table called AREA TABLE INCENTIVE FORM INPUT. The next field in my form is called Team Description. Here is where I want to run a query. The query will connect the AREA TABLE INCENTIVE FORM INPUT (houses all of the distince areas) to the INCENTIVE CRITERIA TABLE (houses the team description to all of the areas). The two tables will be joined via the AREA field. When I run the query I'd like for it to show me a drop-down list of all of the Team Descriptions that pertain only to the Area selected in combo box1. Any assistance would be greatly appreciated.
 
Upvote 0

Forum statistics

Threads
1,221,493
Messages
6,160,139
Members
451,624
Latest member
TheWes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top