I have a textfield [ProjectNo]. When the form opens I would like the textfield to have focus. I would think it has focus because that is where the cursor is when the form opens. But, I have code in the OnFocus, LostFocus, of the ProjectNo textfield and that code is not working, which is why I wrote the code below, to see if I could figure out why.
Here is my code. When the form is open I get the "Don't have focus" message. Do you see the obvious problem that I am missing?
Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
Forms![FRM-InsApQ16]![ProjectNo].SetFocus
If GotFocus = [ProjectNo] Then
MsgBox "I have focus"
Else
MsgBox "I don't have focus"
End If
Any help would be appreciated. Thanks, JL
Here is my code. When the form is open I get the "Don't have focus" message. Do you see the obvious problem that I am missing?
Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
Forms![FRM-InsApQ16]![ProjectNo].SetFocus
If GotFocus = [ProjectNo] Then
MsgBox "I have focus"
Else
MsgBox "I don't have focus"
End If
Any help would be appreciated. Thanks, JL