Problem With Set focus

G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top