Addevent("textbox1",GotFocus,"MySub") ...
textbox1_Gotfocus, will it execute or not?
My code uses AddEvent(ctls(i),"GotFocus","Highlight") in App_start to highlight active textbox and similar sub for LostFocus event to make inactive textboxes' BG white.
Wires a control event to a specific sub.
Syntax: AddEvent (Control Name, Event Name, Sub Name)
...
Note: As in this example, Event Name is not quoted and can't be a variable.
Example:
AddEvent ("Button1", Click, "MySub")
Sub MySub
Form1.Text = Sender.Text
End Sub