'MS Access - Run Query based on User Choice from Drop Down List
I'm trying to create a Microsoft Access form where a user would pick a value from a drop down list and based on that choice a different query would run. For example if the user picks choice A then Query A would run, if B then Query B would run. I have already written the sql query that chooses which query would run based on what choice and it runs perfectly on its own. The problem occurs when I try to incorporate it within my form and add the criteria as [Forms]![myform]![myvalue], the query doesn't even run. I've tried to simplify the query where only simple SELECT FROM query should run when a user makes an input but it also doesn't run. I can't seem to make out where the problem is so I'd be very thankful for your help.
Solution 1:[1]
Create an unbound form, with the dropdown column/combo box that has the choices e.g A,b,c etc
Create a command button.
On the click event of the command button, add an IF statement.
In the images I attached, the following are the names I used.
- Combo box has the name Combo0 and the caption choice
- Command button has the name runquery, and the caption Run Query
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sola Oshinowo |



