473,378 Members | 1,447 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Codes in using short cut keys in a form instead of command buttons.

What are the example codes for the forms instead of using a command buttons.?
Mar 12 '07 #1
7 7595
missinglinq
3,532 Expert 2GB
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!
Mar 12 '07 #2
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!!!!
Mar 12 '07 #3
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...
Mar 12 '07 #4
missinglinq
3,532 Expert 2GB
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.     Me.KeyPreview = True
  3. End Sub
‘Now in Form_KeyDown sub assign actions to keys
Expand|Select|Wrap|Line Numbers
  1. Private Sub form_KeyDown(KeyCode As Integer, Shift As Integer)
  2.     Select Case KeyCode
  3.  
  4.     Case vbKeyF1 ‘This is Access Help and should not be re-assigned
  5.  
  6.     Case vbKeyF2 
  7.       ‘Code for F2 key here
  8.        KeyCode = 0
  9.  
  10.     Case vbKeyF3
  11.       ‘Code for F3 key here
  12.        KeyCode = 0
  13.  
  14.     Case vbKeyF4
  15.       ‘Code for F4 key here
  16.        KeyCode = 0
  17.  
  18.     Case vbKeyF5
  19.       ‘Code for F5 key here
  20.        KeyCode = 0
  21.    End Select
  22. 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!
Mar 12 '07 #5
ADezii
8,834 Expert 8TB
What are the example codes for the forms instead of using a command buttons.?
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.
Mar 13 '07 #6
Thank you every body for helping me!!!!!!!!!!!!!!!!!!!For that function keys!!!!
Mar 13 '07 #7
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.     Me.KeyPreview = True
  3. End Sub
‘Now in Form_KeyDown sub assign actions to keys
Expand|Select|Wrap|Line Numbers
  1. Private Sub form_KeyDown(KeyCode As Integer, Shift As Integer)
  2.     Select Case KeyCode
  3.  
  4.     Case vbKeyF1 ‘This is Access Help and should not be re-assigned
  5.  
  6.     Case vbKeyF2 
  7.       ‘Code for F2 key here
  8.        KeyCode = 0
  9.  
  10.     Case vbKeyF3
  11.       ‘Code for F3 key here
  12.        KeyCode = 0
  13.  
  14.     Case vbKeyF4
  15.       ‘Code for F4 key here
  16.        KeyCode = 0
  17.  
  18.     Case vbKeyF5
  19.       ‘Code for F5 key here
  20.        KeyCode = 0
  21.    End Select
  22. 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!
thank you very much!!!!!!!!!!!!!!!!!!!!!!!!!!youre so kind.....it helps me a lot for my program!!!!
Mar 13 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Chris Bolus | last post by:
I'm a teacher using MS Access on an RMConnect 2.4 network. On some workstations both I and my students sometimes get an error message when attempting to insert a command button on a form which...
1
by: bjbounce2002 | last post by:
Hello, I am using forms with command buttons to close form or run action queries. The error messages such as "Null value in required field" or "duplicate value in primary key" are suppressed....
3
by: AgentX | last post by:
Is it possible to make command buttons in any color other than default gray? And can you change the text with code ? In other words instead of hard-coding the text on the button, can you display...
1
by: davesauny | last post by:
Ok heres the situation: I have a form, with a tabcontrol on it. When the form is started there are a couple of command buttons on the first screen and the rest of the tabs in the control are...
0
by: weezles | last post by:
hi I'm having trouble with using a linked form instead of a sub form on a 1 to many relationship. Then linked form can be accessed from various other forms. When it opens the linked form, if...
3
by: atiq | last post by:
I have got serveral forms where i want to use the same command buttons for each form to navigate through records. i was wondering if there is a way of achieving this without having to create all of...
1
by: tarabztk | last post by:
MSACCESS 2003 : How to use command buttons to display different subforms I have an application that display information about Pipelines and these pipelines have many other equipments attached to...
2
by: colin | last post by:
Hi, I have a form with some buttons and a graphical user control, I need to use the cursor keys to move the camera position in the control, but it has the unfortunate side effect of cycling...
1
by: eHaak | last post by:
A couple years ago, I built a database in MS Access 2003. I built the form using macros in some of the command buttons, and now I’m trying to eliminate the macros and just use visual basic code. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.