Problem With Set focus

N

NNlogistics

I always seem to have problem with setfocus. I want the user to return to
txtRMANumber ids the first character of the RMA Numer doesn't = the Prefex of
the customer

If Left(Me.txtRMANumber, 1) <> Me.txtCustomerPrefix Then

MsgBox ("The First Character of the RMA should start with " &
Me.txtCustomerPrefix & " Please return to Form and Correct, Thank you")
Me.txtRMANumber.SetFocus


Exit Sub

End If

I tried it on events - after update and Lost Focus and the focus ends up in
the next tab field. If I use on before update I get a run time error 2108.
Is there some rule I'm not following??
Thanks for any assistance
 
J

John Spencer

Try using the before update event and setting Cancel to True.

You can't set the focus back to the control using the Lost focus event.
 
Top