AutoKeys

  • Thread starter Thread starter Crystal
  • Start date Start date
C

Crystal

Is there a way to duplicate the functionality of the
AutoKeys macro in code? I have a database that probably
won't be used with a mouse. The user needs to be able to
use the Function keys to navigate through the software.
The function keys will do different things for different
forms. I'd like to be able to code them this way.

If there is no way to duplicate the AutoKeys
functionality, are there any workarounds?

Any help would be greatly appreciated,
Crystal
 
If I recall correctly, AutoKeys is one of the very few things that can only
be done in a macro and not in code.
 
I Crystal!!
I was able to find a way to use the Autokeys using VBA and
MAcros....The following code is a copy of a module in VBA
thats activated when the F5 key is pressed. This code
should explain what needs to be done in order to place
code behind any keys.
This code is simple is takes data from one textBox and
copies it to another. but the way its done, is whats
important.
''''''''''''''''''''''''''''''''''''''''''
Public Function F5() ' The function as the same name as the
' key you want to use.

' this module is for creating macro's behing a certain
' key combinaison press. ex. F5, makes a copy.
' to have access to this code here, by using the
appropriate
' key combinaison, you need to define,in the macro wizard,
the
' key combinaison and add "Runcode" in the right column
beside-it.
' These macros,in both places, have to be stored in a
Module
' called 'AutoKeys'. Its the only way for them(the keys)
to be
' properly activated throughtout the DataBase.

'=========================================================
'****
'**** IMPORTANT: this module his where all the back-end
code
'**** his created.
'****
'=========================================================
' Macro used for copying data from Prod/svcs1 to Prod/svcs2
' on the 'RapportPrincpal' form. Usefull when the
prod/svcs2
' his empty and needs to be filled with the prod/svcs1
content.
Dim e As String


If IsNull(Form_frmRapportPrincpal.Prod_Svcs1.Value)
Then
' exit macro F5
Else
e = Form_frmRapportPrincpal.Prod_Svcs1.Value
Form_frmRapportPrincpal.Prod_Svcs2.Value = e
End If


End Function

Now, don't forget you need to have a reference to that key
in the macro section of Access.Here's how to create this
inside a macro:
Macro Name: {F5} ' name of the key you want, This is also
the name of your function inside your VBA module 'AutoKeys'
Action: Run code
Function Name: =F5() ' Use exactly this format,replace F5
by what you want to use.
AFTER That you can try the key combinaison on the
appropriate form and depending what you wrote in the
function(F5) for example, it should execute.
 
Back
Top