如何使用 VBA 将焦点设置在 MS Access 中的任何对象上

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/652094/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 10:17:16  来源:igfitidea点击:

How to set focus on any object in MS Access using VBA

vbams-accessaccess-vba

提问by Curtis Inderwiesche

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

有人如何使用 VBA 在 MS Access 中设置打开的查询对象的焦点?

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

采纳答案by DJ.

again docmd is your friend :-)

再次 docmd 是你的朋友 :-)

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