What has Focus now, locking a field (1 Viewer)

Banaticus

Registered User.
Local time
Today, 08:10
Joined
Jan 23, 2006
Messages
153
When something loses Focus, the LostFocus event is called. I have a toggle button which changes color when clicked and which unlocks a second form element (which should almost never be changed, so it's usually locked to prevent inadvertant changes). I want to write something like the following:

Private Sub Protection_Button_LostFocus()
If [Protected Field].hasFocusOrSomething = False Then
[Protected Field].Locked = True
End Sub

The only problem is that there isn't a hasFocus property. Is there a "giveFocus()" property? Can I say something like the following:

Private Sub Protected_Button_OnClick()
[Protected Button].Locked = False
[Protected Button].giveFocusToOrSomethingLikeThat
End Sub
Private Sub Protected_Field_LostFocus()
[Protected Field].Locked = True
End Sub
 

Banaticus

Registered User.
Local time
Today, 08:10
Joined
Jan 23, 2006
Messages
153
I found a solution. After the toggle box is clicked, it now specifically calls the SetFocus property of the "secure" field. I added a LostFocus event which calls the After Update property of the "secure" field.

Private Sub App_Type_Toggle_Click()
App_Picture_Set
[Apprentice Type].SetFocus
End Sub
Private Sub Apprentice_Type_LostFocus()
Apprentice_Type_AfterUpdate
End Sub
 

Users who are viewing this thread

Top Bottom