Results 1 to 6 of 6
  1. #1
    tobydobo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    169

    How to assign a hotkey to a command button


    I have a macro program that allows you to create hotkeys for certain functions and routines. Is there a way to assign a hotkey to a command button?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The macro assigns 'hotkeys' to keyboard keys? A command button can have a shortcut key assigned by using & character. Type the & in front any character in button caption and it will be a 'hotkey' (Alt+character) for the equivalent of clicking the button with mouse. If there are no data controls for the cursor to fall into, then don't even need the alt key.
    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
    tobydobo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    169
    Well not exactly. I have a specific windows automation task assigned to a hot key using a program called macro express. So say I assign a macro to hotkey 'shift + f1' and i want to have a command button emulate that specific key combo to trigger the automation task outside of a dB.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I suppose you could use SendKeys method to emulate the shift+f1. The only keystrokes I have used SendKeys for is ESC.
    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
    tobydobo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    169
    IWell that's a start. Can u provide the basic syntax in how u did that?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    SendKeys "{ESC}", True

    Access Help has guidelines on SendKeys method.
    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. Assign converted macro to navigation panel button
    By nhylan in forum Programming
    Replies: 4
    Last Post: 04-17-2013, 01:33 PM
  2. Assign F5 function to a button
    By eduardo in forum Forms
    Replies: 4
    Last Post: 06-24-2012, 08:21 AM
  3. Replies: 1
    Last Post: 07-27-2010, 02:27 PM
  4. Accessing a Tab with a HotKey
    By SCFM in forum Programming
    Replies: 2
    Last Post: 03-13-2010, 07:28 AM
  5. Replies: 6
    Last Post: 02-09-2010, 07:53 AM

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