Controlling focus

robinski

New member
Local time
Today, 19:14
Joined
Oct 21, 2001
Messages
6
I have this code in the Lost Focus Event to prevent a null value.

If IsNull(Me.Analysis) Then
MsgBox "Need To enter Data Here in this field",, "Need Data"
Me.Analysis.SetFocus
End If

After OK is clicked the focus goes to the Analysis field but moves straight on to the next field in the tab order.

What am I doing wrong?
 
You need to set the focus to any other control first, then back to the control you want to actually receive focus.

If IsNull(Me.Analysis) Then
MsgBox "Need To enter Data Here in this field",, "Need Data"
Me.AnyOtherControlName.SetFocus
Me.Analysis.SetFocus
End If

HTH
RDH
 

Users who are viewing this thread

Back
Top Bottom