Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Access Hot Keys for Function Keys


Message #1 by "Craig Harrison" <craig.harrison@w...> on Thu, 31 Oct 2002 15:32:34
Dear developers,

I have an Access 2000 database that I have implemented at work.  My users 
are not that computer literate and I would like to set up Hot Keys for 
them to carry out some of their tasks on the computer but only in Access.  
Simply, I want to push the F12 key and for the cursor to move back into 
the 'search' text box ready for the next query.

I am hoping not to buy a 3rd party application for this, but use Access's 
own functions or API calls maybe.

Any ideas? Thanks, Craig.
Message #2 by Omar Chaudry <OChaudry@b...> on Thu, 31 Oct 2002 15:28:24 -0000
This is what you do:-
1. Create a Macro called AutoKeys
2. In the macro design view click on the view menu and select Macro Names.
3. Now if you want to invoke a command by pressing the F12 key put {F12} in
the name column
4. In the code column run the appropriate code by setting the various
options (you may need to play with these)

HTH
Omar

-----Original Message-----
From: Craig Harrison [mailto:craig.harrison@w...] 
Sent: 31 October 2002 15:33
To: Access
Subject: [access] Access Hot Keys for Function Keys

Dear developers,

I have an Access 2000 database that I have implemented at work.  My users 
are not that computer literate and I would like to set up Hot Keys for 
them to carry out some of their tasks on the computer but only in Access.  
Simply, I want to push the F12 key and for the cursor to move back into 
the 'search' text box ready for the next query.

I am hoping not to buy a 3rd party application for this, but use Access's 
own functions or API calls maybe.

Any ideas? Thanks, Craig.


  DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee.  Access to this
message by anyone else is unauthorised.  If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful.  Please immediately contact the sender if you have received this
message in error. Thank you.


Message #3 by "Hamilton. Tom" <hamiltont@s...> on Thu, 31 Oct 2002 07:56:51 -0800
Hi Craig,
This type of request is common and easily solvable.  There are a couple 
of ways to do what you ask. 
The option which I prefer, requires you to implement VBA code in the 
forms that you need this functionality. 
The other option is to implement an 'Autokeys' macro (see the Help file 
for guidance).  While this works, it will expose the methon to your 
entire application which may not be quite right for you, additionally, 
there's no good way to handle Errors with macros.

Question:
This 'Search' box you speak of - is it a form or field of yours or is it 
the Find Dailog box? 

If it is one of your forms, then Open your form in Design View, Open the 
Properties panel
1) Set 'Key Preview' =3D Yes
2) Set 'On Key Down' =3D [Event Procedure], or click the Builder 
ellipses to create the following procedure

' Code start *******************************************
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  ' Make sure to trap for errors, to avoid those unsightly error alerts!
  On Error GoTo Form_KeyDown_Err
  Select Case KeyCode
    Case vbKeyF12				' See Help - Access Key Constants for a full 
listing
'Place you code here... if using the Find dialog then
 Screen.PreviousControl.SetFocus
' Watch your version if not 97, then not acMenuVer70, Access2000=3D80
 DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70=09
'If you're using your own Find Fieldf then you can use  
me.[MySearchFieldName].SetFocus
          Case Else
      ' Do nothing at all!
  End Select

Form_KeyDown_Exit:
  Exit Sub
 
Form_KeyDown_Err:
  MsgBox "Error: " & Err.Description & " (" & Err.Number & ")"
  Resume Form_KeyDown_Exit
End Sub
'Code end *******************************************


Tom Hamilton
T_Systems, Inc
(xxx) xxx-xxxx

 -----Original Message-----
From: 	Craig Harrison [mailto:craig.harrison@w...]
Sent:	Thursday, October 31, 2002 7:33 AM
To:	Access
Subject:	[access] Access Hot Keys for Function Keys

Dear developers,

I have an Access 2000 database that I have implemented at work.  My 
users
are not that computer literate and I would like to set up Hot Keys for
them to carry out some of their tasks on the computer but only in 
Access. 
Simply, I want to push the F12 key and for the cursor to move back into
the 'search' text box ready for the next query.

I am hoping not to buy a 3rd party application for this, but use 
Access's
own functions or API calls maybe.

Any ideas? Thanks, Craig.

Message #4 by "Craig Harrison" <craig.harrison@w...> on Thu, 31 Oct 2002 17:22:16
Many thanks Omar :D

I used the following code in the finction name box: 

forms![snheader].txtsearch.setfocus

Craig.

  Return to Index