Unable to Setfocus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a data entry form. One of the data field is an account number. To perform a validation check, I used the AfterUpdate event, and if the account number is not correct, I program it to pop up a message and then use the 'Me.txtAccount.Setfocus'. This way, I am expecting the focus will go back to the same textbox for the user to re-enter the data. But, no matter how I try, it still goes to the next textbox according to the next tab index number
Any suggestions
Thank you
Marti
 
I have a data entry form. One of the data field is an account
number. To perform a validation check, I used the AfterUpdate
event, and if the account number is not correct, I program it to
pop up a message and then use the 'Me.txtAccount.Setfocus'. This
way, I am expecting the focus will go back to the same textbox for
the user to re-enter the data. But, no matter how I try, it still
goes to the next textbox according to the next tab index number.
Any suggestions? Thank you! Martin

You're using the wrong event.
If this is at the Control level, use the Control's BeforeUpdate
event:
If Blah not Blah then
Cancel = True
End If

If this is at Form level, use the Form's BeforeUpdate event:
If Blah not Blah then
Cancel = True
[ControlName].SetFocus
End If
 
Back
Top