Query List

whitestone

Usually Confused
Local time
Today, 16:06
Joined
Oct 29, 2002
Messages
35
I have a form from which I want users to be able to query the database, access a list of previously created queries and create a new one.

I don't really however, want users to access the database window. Does anyone know how I should go about this?

If not can I create a button on the form that opens the databse window in query?

Thanks

Ben
 
If you have named all your queries with the qry prefix you could have a listbox that lists all your queries by setting its RowSource to:

Code:
SELECT MSysObjects.Name, Left([Name],3) AS YourTest
FROM MSysObjects
WHERE (((Left([Name],3))="qry"));
 
And then, to run the selected query it wold simply be a case of:

DoCmd.OpenQuery Me.cboYourQueryList
 
I still can't get it to work.

What do I put in Row Source Type??

Sorry to be thick but I don't know much VBA.

Also, is there a way of having a button that opens a brand new query (in design view) every time? I couldn't work out a macro to do this.

Thanks again

Ben
 
Firstly, have you named your queries with the qry prefix? If not, my solution won't work.

The idea was to put a listbox on your form with all the queries in your database listed in it. The statement I gave would have listed them all for you if you had that prefix on your queries.

As for the design view of a query, I don't know.
 
Excellent, it worked.

I don't know why it didn't before though but I tinkered and tweaked and it is all good now.

Will look into opening a new query in design view.
 

Users who are viewing this thread

Back
Top Bottom