Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ALT+XX skips lost focus event - need to validate

Status
Not open for further replies.

dataent

Programmer
Jun 19, 2001
29
US
I use the lost focus event of the text box for my data validation. I have a "&Save" button on the form so the user can do an ALT+S, however this skips over the lost focus event. I need some way to make the lost focus event get fired off. Does anyone have any suggestions???
 
Well I'm sure there is a more professional way, but for a quick dirty fix just put the following in the beginning of your cmdSave_Click event or whatever event that is called when someone pushes "ALT-S":

Text1.SetFocus 'obviously use the right control name
Command1.SetFocus 'obviously use the right control name


That'll give the focus to the textbox control and then give the focus to your button which will cause Text1_LostFocus() to fire.
 
Is there a way to know if the person pressed "alt-s" or if they actually clicked with the mouse?

Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top