how to test if a particular control has focus?

后端 未结 2 1498
春和景丽
春和景丽 2021-01-19 05:07

i have access 2007 form and i want to test if a particular control (toggle button) has the focus ,

something like :

if gotfocus(mytoggle) then
dosom         


        
2条回答
  •  轮回少年
    2021-01-19 05:31

    This for the current form:

    If (mytoggle Is Me.ActiveControl) Then
    

    This for the current Access.Application:

    If (mytoggle Is Screen.ActiveControl) Then
    

    Be careful, if no control has focus, *.ActiveControl may not exist.

提交回复
热议问题