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

Question about acCmdNewObjectDesignQuery

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
0
0
US
I have some vba code that resides in my library database "MyLib.accda" (to which I have referenced). When the user clicks a button located on a form in my current database "MyCustom.accdb", a form that exists in my library is opened and the activeform (frmMain) is hidden. The library form has a button that , when pressed, executes this code:

Code:
Application.DoCmd.RunCommand acCmdNewObjectDesignQuery

The problem is that acCmdNewObjectDesignQuery launhes the query builder. The query builder lists all of the tables and queries that exist in my library database rather than my current database.
If I don't hide frmMain but, rather, setfocus to it prior to issuing the Application.Docmd.Run..., then the query build lists all of the tables and queries that exist in my current db. Which is what I want.

My question is: Since I can't setfocus to frmMain because it's hidden, what's the correct syntax for the line of code, shown above, so it only displays objects in my current db? Or can I set focus to the current database rather than a specific object? If so, how?
 
Well, this honestly sounds like a weird request to me, but if it's what you want to do...

My first thought would be to try this.... make the main form visible, then set focus to it, then do your new query line, then set focus back to main, hide it, and set focus back tot he new query object... well, it may automatically go to the query after re-hiding the main form.

This is just an idea, I've not even tried to test it.

"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top