I have the following code in the After Update event of a combo box on a form.
Private Sub jobNumber_AfterUpdate()
If (<<condition 1>>) Then
MsgBox "Please choose different job Number"
Me.jobName.SetFocus
Me.jobNumber.SetFocus
Else
....
End If
End Sub
I want to keep the focus in the jobNumber combo box if <<condition>> 1 is met. The only way I can do this is by setting the focus to another control on the form, and then setting the focus back to jobNumber (as above).
Is there another less klunky way to do this, as just putting in the line Me.jobNumber.SetFocus on its own does not work.
I do not want to add the code to the On Exit event as I have other code in the after update event that must be executed in <<condition 1>> is not met.
Any suggestions gratefully recieved
Gavin
Private Sub jobNumber_AfterUpdate()
If (<<condition 1>>) Then
MsgBox "Please choose different job Number"
Me.jobName.SetFocus
Me.jobNumber.SetFocus
Else
....
End If
End Sub
I want to keep the focus in the jobNumber combo box if <<condition>> 1 is met. The only way I can do this is by setting the focus to another control on the form, and then setting the focus back to jobNumber (as above).
Is there another less klunky way to do this, as just putting in the line Me.jobNumber.SetFocus on its own does not work.
I do not want to add the code to the On Exit event as I have other code in the after update event that must be executed in <<condition 1>> is not met.
Any suggestions gratefully recieved
Gavin