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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get DoCmd.RunCommand acCmdNewObjectDesignQuery to work?

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
US
OK, my subject is a little misleading. I know how to get it to work. My problem is that I'm executing the command from within a "wizard" database I've created. For example, I register my wizard as an AddIn and then select an item from the AddIns menu. My wizard form pops up and asks a few question. One of the questions is for the user to select a query from a combobox. The queries that are listed reside in my Currentdb not the wizard database. I have no problem getting that list. However, if the user has not yet created the query, I want them to select a button that will execute the command "DoCmd.RunCommand acCMDNewObjectDesignQuery". Although that works, when the query builder opens, it presents the user with the names of tables and queries that reside in the Wizard database and not in the current database.

So how I can I get the Query Builder to list the names of the tables and queries that reside in the CurrentDb and not the CodeDb (wizard database)?

One solution would be to set the Source Database property of the query to the CurrentDb. But how do I do that programmatically and prior to the list of tables and queries being presented?

Another solution, that works, is prior to issuing DoCmd... I set focus to a form that is opened in my current database. The problem is that the user may not have a form open. Is there a way to set focus to the database?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top