Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I just wanted to say that you guys RULE, a million thank you's to whoever created, and/or manages this site. KEEP UP THE GOOD WORK..."

Geography

Where in the world do Tek-Tips members come from?
FancyPrairie (Programmer)
26 Jun 12 15:26
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?
kjv1611 (TechnicalUser)
29 Jun 12 11:42
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

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close