Microsoft KB Archive/140789

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

Article ID: 140789

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q140789





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.  Open the sample database Northwind.mdb (or NWIND.MDB in version 2.0.) Open the Customers form in Design view.  Add a command button to the form with the following event procedure: Sub Command10_Click SendKeys "^F" End Sub  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.  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 </li> Open the Customers form in Form view, and then click the command button. Note that the Find Window now appears as expected.</li></ol>

<div class="references_section">