Curtis Inderwiesche
Curtis Inderwiesche

Reputation: 4990

Set focus on any object

How can someone set the focus of an opened Query object within MS Access using VBA?

I am doing something like this...

 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

Upvotes: 6

Views: 12714

Answers (1)

DJ.
DJ.

Reputation: 16267

again docmd is your friend :-)

'set the focus
DoCmd.SelectObject acQuery, myqueryname, False

Upvotes: 6

Related Questions