我可以 Access 2007 表单,我想测试特定控件(切换按钮)是否具有焦点,
就像是 :
if gotfocus(mytoggle) then
dosomething
endif
或者可能喜欢:
if me.mytoggle.setfocus = true then
dosomething
endif
我已经搜索过但找不到这个,有人能告诉我什么是正确的吗?
最佳答案
这对于当前的形式:
If (mytoggle Is Me.ActiveControl) Then
这对于当前的 Access.Application:
If (mytoggle Is Screen.ActiveControl) Then
请注意,如果没有控件具有焦点,*.ActiveControl 可能不存在。
关于vba - 如何测试特定控件是否具有焦点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20373426/