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
 

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


Back
Top