title: Set focus on any object
body: <p>How can someone set the focus of an opened Query object within MS Access using VBA?</p>
  
  <p>I am doing something like this...</p>
  
  <pre><code> If Application.CurrentData.AllQueries(myqueryname).IsLoaded = True Then
        'set the focus
  
        ' Export to office links for analysis
        CommandBars("Menu Bar").Controls("Tools").Controls("Office Links").Controls("Analyze It With Microsoft Office Excel").accDoDefaultAction
  </code></pre>