macro to open any query in database

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 -
 
S

Steve Schapel

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top