How to reset focus on a textbox OnLostFocus

D

Danny

I am trying to error check what the user has entered in a
text box right when the user tries to lose focus on the
textbox. When the data entered is correct it populates
some other fields but what was entered was wrong, I clear
the textbox and I would like to reset focus on the
textbox so the user can reenter another number.
I tried clearing the textbox and .setfocus right after
but the focus just continues to the next tab order.

Is there anyway I can reset focus?

Thanks,
Danny
 
K

Ken Snell [MVP]

Use the BeforeUpdate event of the textbox, not the OnLostFocus event. The
BeforeUpdate event has a Cancel argument, which allows you to cancel the
update and keep the focus in the textbox.
 

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

Top