I have some code that has to be run in the LostFocus event of a textbox.
It checks the contents, and if they're not ok according to some rules, it sets the focus back on the textbox and higlights the text...
If ... Then
MsgBox "The UAN you entered is not valid, please retype", vbCritical, "Invalid UAN"
Cancel = True
Me.B_C.SelStart = 0
Me.B_C.SelLength = Len(Me.B_C.Value)
That works fine in the BeforeUpdate event where cancel is a parameter, and I understand why it won't work in the LostFocus event, but is there some kind of workaround? ie would it work if I abstracted the code to a module or something along those lines?
Thanks for your help