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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Key press event problem

Status
Not open for further replies.

nina1

Programmer
Aug 14, 2001
31
CA
I have three buttons on the form "Save", "Exit" and "Print", when the user save the record it might go to the entry box again (combobox on the form) or might just close the form or print entered record.
My problem is how to recognize user's input. I have shortcuts like Alt + S-Save, Alt + P-print and Alt+C-close, but the problem is to get the focus on the button.
I was reserching the key press event but couldn't figure it out completly.
Any help would be appreciated!

Thanks
 
When you say Alt+S for Save button; the caption must be Save and in the design view it should be written as &Save
Is that correct?

________________________________________________________
Zameer Abdulla
Help to find Missing people
You may be the boss' pet; but you are still an animal
 
Yes and for Alt-P is the same change, but the problem is that the button needs to hava a focus in order that this shortcuts works.
 
Set the form's KeyPreview = Yes
or
You need to use three keys ALT+S to get the focus on it and enter key to activate it.

or
How about adding some code on the GotFocus Event?
Code:
Private Sub CmdSave_GotFocus()
    Call cmdSave_Click
End Sub
Beware!! This may trouble you some time

________________________________________________________
Zameer Abdulla
Help to find Missing people
You may be the boss' pet; but you are still an animal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top