macro to open any query in database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to construct a macro that will open any query in a database. I
see that I can use the 'OpenQuery' action to open a specfic query by
supplying the name of the query as an argument. Is there a way to set up a
macro so that when it runs, the user is presented with a list of all the
queries in the database, and must choose which one to run?
Thanks for any help -
 
Michalaw,

The OpenQuery action would normally only be used to run action queries
(Append, Update, etc). It is generally not recommended to expose the
datasheet of a Select query.

You could make a table listing the names of the available queries, and
then use this table as the Row Source of a combobox or listbox on a
form. The user could select the name of the query from the combobox or
listbox. Then, in your macro, in the Query Name argument of the
OpenQuery action, you could enter the equivalent of this...
=[Forms]![NameOfForm]![NameOfCombo/List]
 
Back
Top