Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New Query from Command Button

Status
Not open for further replies.

wally1169

IS-IT--Management
Aug 25, 2003
6
0
0
US
Does anyone know if there is a way to open the design view of a new query by clicking on a command button? I'd like for an user to be able to make a query, without leaving the form interface.
 
why is the user making a query? - you should allow the user to pick what arguments (in some fashion)- then build the query (vba)- then return the results..

users should not do anything in design mode imho.

Randall Vollen
National City Bank Corp.

Just because you have an answer - doesn't mean it's the best answer.
 
Just use code like this:

DoCmd.OpenQuery "qryMyQuery"

 
hwkranger:
This is only used by the IT department, so it isn't a problem that they use the design mode, I was just trying to make it easier to access it. Besides, it needs to be saved as a query in the database in order to work in other parts of the database.

BSman:
I want it to be a new query that hasn't been created yet. Do you know how to do that?

Thanks,
Wally Bahny
 
Actually, I've written a form that is a query builder for use by non-IT users in a menu driven system, so yes I've built queries in code.

However, since you want to let users use the Access query design, using the DoCmd.DoMenuItem option to open the query builder. (I don't know what the menu steps are, so you'll have to check them yourself.)

As far as I'm concerned, when not just have the database window visible. If you are letting your users use the query builder, then let them see the database window and call the new query design from the database window themselves.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top