ACC: Using SendKeys to Simulate Hot Keys Fails If in Uppercase

Last reviewed: August 28, 1997
Article ID: Q140789
The information in this article applies to:
  • Microsoft Access versions 2.0, 7.0, 97

SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

When you use the SendKeys statement to send keystrokes to the user interface in Microsoft Access and you use the CTRL key designation (^) in combination with uppercase characters, the action fails silently.

RESOLUTION

Use lowercase letters in SendKeys statements when simulating user interface key combinations that use the CTRL key designation.

STATUS

This behavior is by design.

MORE INFORMATION

The following example uses a simple function to send the CTRL+F key combination to the user interface to open the Find window.

CAUTION: Following the steps in this example will modify the sample database Northwind.mdb (or NWIND.MDB in version 2.0). You may want to back up the Northwind.mdb (or NWIND.MDB) file and perform these steps on a copy of the database.

  1. Open the sample database Northwind.mdb (or NWIND.MDB in version 2.0.)

  2. Open the Customers form in Design view.

  3. Add a command button to the form with the following event procedure:

          Sub Command10_Click()
             SendKeys "^F"
          End Sub
    
    

  4. Open the Customers form in Form view, and then click the command button. Note that the Find window does not appear and no beep is generated to indicate an invalid key combination.

  5. Switch the Customers form to Design view, and change the event procedure on the command button to:

          Sub Command10_Click()
             SendKeys "^f" 'Note the lower case "f"
          End Sub
    
    

  6. Open the Customers form in Form view, and then click the command button. Note that the Find Window now appears as expected.

REFERENCES

For more information about the SendKeys statement, search the Help Index for "SendKeys statement."

Keywords          : kbprg MdlGnrl
Version           : 2.0 7.0 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbbug
Solution Type     : kbworkaround


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.