What are the example codes for the forms instead of using a command buttons.?
Codes in using short cut keys in a form instead of command buttons.
Collapse
X
-
Tags: None
-
If you're asking how to set up shortcuts keys so that you don't have to click on the command buttons, you don't need any code. Just place a command button on the form and use the wizard or right the code to set its function. Goto the button's Property Box and in the Caption box enter the Caption for the button, preceding the letter that you want to use as the shortcut key with an ampersand. If the text you want on the button's is Close, then in the Caption box enter &Close. Now when you hit <Alt> + <C> it will be the same as clicking on the Close button.
Hope this helps! -
thanks for the your reply to my questions.But what i mean is that how to use the short cut keys like F3,F4..Example you want that the Close Command can be executed by using a short key like F3 instead of Clicking the command button Close...thank you!!!!Originally posted by missinglinqIf you're asking how to set up shortcuts keys so that you don't have to click on the command buttons, you don't need any code. Just place a command button on the form and use the wizard or right the code to set its function. Goto the button's Property Box and in the Caption box enter the Caption for the button, preceding the letter that you want to use as the shortcut key with an ampersand. If the text you want on the button's is Close, then in the Caption box enter &Close. Now when you hit <Alt> + <C> it will be the same as clicking on the Close button.
Hope this helps!Comment
-
I want the codes for using short cut keys like F3,F4 etc. to execute the commands like close or in the main menu to open another form.
example is that:
PRESS F3 TO OPEN STUDENT ENTRY SCREEN
F4 TO CLOSE THE FORM
I want the codes for it...Comment
-
Function Keys are not shortcut keys, they're Function Keys! What you're talking about is re-assigning the use of the Function Keys. You should always consider what the native function of these keys are before changing their functions! F1, for example, pulls up Access Help, and should never be re-assigned.
Set KeyPreview to TRUE either in Form’s Property Box or as follows:
‘Now in Form_KeyDown sub assign actions to keysCode:Private Sub Form_Load() Me.KeyPreview = True End Sub
And so forth! You can also assign other keys in this manner, just remember to consider the "normal" function before re-assigning any key!Code:Private Sub form_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyF1 ‘This is Access Help and should not be re-assigned Case vbKeyF2 ‘Code for F2 key here KeyCode = 0 Case vbKeyF3 ‘Code for F3 key here KeyCode = 0 Case vbKeyF4 ‘Code for F4 key here KeyCode = 0 Case vbKeyF5 ‘Code for F5 key here KeyCode = 0 End Select End Sub
Comment
-
You can create an AutoKeys Macro to do virtually anything in Access simply by a single or multiple Key(s) combination(s). It involves no code, per say, but only a familiarization with various Key designators, e.g. (+ for SHIFT, ^ for CTRL, and % for ALT, {F4}, {F7}, etc.). If you need more information, please let me know.Originally posted by vitaminB18What are the example codes for the forms instead of using a command buttons.?Comment
-
-
thank you very much!!!!!!!!!!! !!!!!!!!!!!!!!! youre so kind.....it helps me a lot for my program!!!!Originally posted by missinglinqFunction Keys are not shortcut keys, they're Function Keys! What you're talking about is re-assigning the use of the Function Keys. You should always consider what the native function of these keys are before changing their functions! F1, for example, pulls up Access Help, and should never be re-assigned.
Set KeyPreview to TRUE either in Form’s Property Box or as follows:
‘Now in Form_KeyDown sub assign actions to keysCode:Private Sub Form_Load() Me.KeyPreview = True End Sub
And so forth! You can also assign other keys in this manner, just remember to consider the "normal" function before re-assigning any key!Code:Private Sub form_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyF1 ‘This is Access Help and should not be re-assigned Case vbKeyF2 ‘Code for F2 key here KeyCode = 0 Case vbKeyF3 ‘Code for F3 key here KeyCode = 0 Case vbKeyF4 ‘Code for F4 key here KeyCode = 0 Case vbKeyF5 ‘Code for F5 key here KeyCode = 0 End Select End Sub
Comment
Comment