Results 1 to 15 of 15
  1. #1
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124

    Can you use AutoKeys Macro in MS Access 2010?

    I can't seem to create an AutoKeys macro in MS ACCESS 2010. IS it possible and if so a clearway to create an Autokeys macro.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    I have an autokeys macro. It was created with Access 2007 but still works fine.

    Exactly what is the issue you encounter? What happens - error message, wrong results, nothing?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124
    Thanks for the quick response but I haven't been able to create an AutoKeys macro in MS Access 2010. My question was "Can you create an AutoKeys macro in MS Access 2010 and if so, How?" Any helpwould be appreciated.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Just tested.

    1. Open macro design

    2. Click Submacro from Action Catalog

    3. Entered ^p into Submacro name box

    4. Selected MessageBox action - message "Ctrl+p disabled"

    5. Saved macro named AutoKeys - I got error message but the macro did save, however, the ^p Submacro name was not saved. I reopened macro in design, entered the ^p and saved again. This time no error.

    Macro works.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124

    AutoKeys maco in MS Access 2010

    Quote Originally Posted by June7 View Post
    Just tested.

    1. Open macro design

    2. Click Submacro from Action Catalog

    3. Entered ^p into Submacro name box

    4. Selected MessageBox action - message "Ctrl+p disabled"

    5. Saved macro named AutoKeys - I got error message but the macro did save, however, the ^p Submacro name was not saved. I reopened macro in design, entered the ^p and saved again. This time no error.

    Macro works.
    I triedto create the macro as stated and it created a macro named AutoKeys. In place of ^p I used the string F1 and later tried {F1} the macro gave an error but it didn't trap the F1 key, Any help would be appreciated.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    I've never tried to trap function keys. But should work according to https://support.office.com/en-us/art...B-A3C81AF676BE

    Which I just tested by replacing ^p with {F1} - it works.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124
    Quote Originally Posted by June7 View Post
    I've never tried to trap function keys. But should work according to https://support.office.com/en-us/art...B-A3C81AF676BE

    Which I just tested by replacing ^p with {F1} - it works.
    I must be doing something wrong. I created a Macro and named it AutoKeys. I inserted a submaco and named it {F1} using braces as required IAW the Help file. I then added a Messagebox command which displays "F1 key pressed" and then I added a RunCode command with "ShowF1help()". the function SHowF1Help returns True or false and has no parameters. The error I get is "MS Access can't find the fucntion listed"
    Code:
    '---------------------------------------------------------------------------------------
    ' Procedure : ShowF1Help
    ' Author    : Admin
    ' Date      : 4/9/2015
    ' Purpose   :
    '
    'Parameters:
    'Return:
    'Changed:Ck#1
    'Functions Used:CT#1
    '---------------------------------------------------------------------------------------
    
    
    Public Function ShowF1Help() As Boolean
    
    
    On Error GoTo ErrorHandler
    Const CALLER As String = " Form_frmCommittee:ShowF1Help "
    Dim tHelp As tHelpConstants
    Dim strpath As String
    Dim strMain As String
    Dim bResult As Boolean
    
    
    strMain = Me.Name
    
    
     'tHelp.gstrFName = GetHelpFile(strMain)  'gets the new RTF file Name
        Debug.Print Me.Name  'OK got it
        'tHelp = SetUpHelp(frmMain)
    ''get name if Help ODF file created and stored in M_DocDir & "\Help PDF Files\" directory
        strpath = M_DocDir & "\Help PDF Files\" & tHelp.gstrFName
       'new Display the PDF file strpath displaying help for the current form
       OpenPDF (strpath)
        bResult = True
        
    Cleanup:
       ShowF1Help = bResult
       Exit Function
    
    
    ErrorHandler:
        MsgBox Err.Description & vbCrLf & _
               Err.Number & vbCrLf & _
               "Called By :" & CALLER & vbCrLf & _
               Err.Source, VbMsgBoxStyle.vbCritical, "Could not add new name to data base" & vbCrLf & _
                "Module Name: = " & MODULENAME
                bResult = False
                
                    
        GoTo Cleanup
    
    
    
    
    
    
    End Function
    When I run the Autokeys macro it displays the Messagebox string correctly but then can't find the SHowF1Help function. The MS Help dialog box is displayed instead of the PDF file SHowF1Help would show. I must be doing something different. I am using MS Access 2010 in Windows 7 Professional. Any help would be appreciated. I am able to successfully run the ShowF1help function on a test form using a command button Click event.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Is that function in a general code module?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124
    Quote Originally Posted by June7 View Post
    Is that function in a general code module?
    I am not sure what a general code module is? DOes this mean not a module for a form? In other words a Public function created in a module not associated with a form?

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    That is correct. A code module not associated with a form or report.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124

    AutoKeys macro for MS Access 2010

    Quote Originally Posted by June7 View Post
    That is correct. A code module not associated with a form or report.
    I moved the function to a separate Code module and now the function is accepted in the MAcro Runcode command. However the Auokeys macro does not run when the F1 key is pressed in the application. The MS Office help dialog box appears. But I remember something about KeyPreview?? I'll ck that property. Thanks for your Help I really appreciate it. '

  12. #12
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124
    I can't seem to find the referenceto the Key Preview property. Any ideas? Is it in the Form properties? Still can't get the application to respond to my "F1" keypress. The macro is error free but the AutoKeys part is ignored.

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Odd. I have no problem executing the macro when F1 is pressed. MessageBox and function both run.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124

    F1 key capture using AutoKeys vs KeyDown form event

    Quote Originally Posted by June7 View Post
    Odd. I have no problem executing the macro when F1 is pressed. MessageBox and function both run.
    Thanks for all your help. I can run the Autokeys macro with no errors and it displays a PDF document with the specific help for the active form or control. It works but I can't get the "Windows Help and Suipport " dialog box from appearing even though there is a Keycode= 0 in the forms Keydown event. My Help screen appears simultaneously and I just press the Close icon for the Windows dialog box. I must have a very peculiar system since no one else is having this problem. I can live with what the situation but my curiosity is killing me since I can't find a real answer to the problem. Once again thanks for all the effort. Does any one else get this "Windows Help and Support" dialog box when F1 key pressed. I will try a Shift F1 to see if I can work around this conundrum.

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    I do not get the Help window. Not using KeyDown event. Tested on two computers. Cannot replicate issue.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Autokeys
    By sergran in forum Programming
    Replies: 10
    Last Post: 10-05-2013, 10:51 AM
  2. Data Macro in Access 2010
    By rkalapura in forum Programming
    Replies: 1
    Last Post: 07-06-2012, 08:38 AM
  3. Access 2010 first macro - errors
    By DLParker in forum Forms
    Replies: 9
    Last Post: 10-16-2011, 04:17 PM
  4. Access 2010 Macro Help
    By RayMilhon in forum Access
    Replies: 3
    Last Post: 09-30-2011, 12:03 PM
  5. Access 2010 Macro
    By RayMilhon in forum Access
    Replies: 3
    Last Post: 09-28-2011, 11:37 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums