Populate a combo box with queries !

ponneri

Registered User.
Local time
Tomorrow, 03:15
Joined
Jul 8, 2008
Messages
102
Hi all,

How can I populate all my queries in a combo box on a form ?

What I mean is, I need to list all the queries in my navigation pane - into a combo box on a form and then run those queries when user selects a particular query.

Is there a way to do this easily or with minimum VBA code ?

Any help will help :-)
 
I would use a list box as it's easier to look through - and I would only list queries you want by naming them in a specific format, don't list every single query.
This will list all queries that are saved with "man_" at the beginning of their name, and displays it without that to make it more readable. Put this in the Row Source of the list box.

SELECT MsysObjects.Name, Mid([Name],5) AS QueryName FROM MsysObjects WHERE (((Left([Name],4))="man_")) ORDER BY MsysObjects.Name;
 
I agree with Minty's solution but I would also include in your criteria

and [Type]=5

just in case you have any other objects starting with 'man_'

Assuming you have a variety of query types (select, update, append, delete) you may also want to precede their names with different prefixes to avoid confusion (mSel_, Mupd_, Mapp_ etc)
 
Thank you both so much !

I'll try it out soon @ my work place.
 

Users who are viewing this thread

Back
Top Bottom