Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to test if a particular control has focus?

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
dosomething
endif

or maybe like :

if me.mytoggle.setfocus = true then
dosomething
endif

I have searched and cannot find this , can someone tell me what is correct top to do this ?

like image 773
user1921704 Avatar asked Dec 26 '22 16:12

user1921704


1 Answers

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.

like image 153
jacouh Avatar answered Jan 16 '23 17:01

jacouh