Microsoft Access - select query based on contents of combo box

  • Good Afternoon,

    I have an access form with a combo box (combo_rule) that lists a number of queries.

    When I hit the run button, I woul like to run the query that has been selected in the combo box.

    Can anyone advise the best way to do this



  • Mark

    You could use DoCmd.OpenQuery for that, something like this

    DIm strQueryName As String
        strQueryName = Me![combo_rule].Value
        DoCmd.OpenQuery strQueryName, acViewNormal

    Note, you can change the 2nd argument View how you want the query displayed/what you want to do with it, see here for more information.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!