Originally Posted by
ScottXe
I tried to set the focus in the previous control "txtAdd" without success. Can someone advise me why it does not work in the after update event of txtAdd control
This is just one of those Access quirks! To get Focus to stay in a Control, if some validation on the entered data fails, you have to use the Control's BeforeUpdate event, and set Cancel = True. This stops the update of the Field and leaves Focus in the Control.
Code:
Private Sub txtAdd_BeforeUpdate(Cancel As Integer)
' If Validation Code fails
'Messagebox warning to user
Cancel = True
End Sub
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007