Microsoft KB Archive/210197

= ACC2000: Use of SendKeys to Simulate Hot Keys Is Unsuccessful if Characters Are Uppercase =

Article ID: 210197

Article Last Modified on 6/23/2005

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q210197



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

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SYMPTOMS
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 is unsuccessful, although you receive no beep to indicate an invalid key combination.



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



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To create a simple function to send the CTRL+F key combination to the user interface to open the Find window, follow these steps:

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

 Start Microsoft Access and open the sample database Northwind.mdb or the sample project NorthwindCS.adp. Open the Customers form in Design view. If the Toolbox is not visible, on the View menu, point to Toolbars, and then click Toolbox. If the Control Wizards control on the Toolbox is selected, click it to clear it. Click the Command Button control, and then click in the upper-right area of the Detail section of the form. If the property sheet is not visible, on the View menu, click Properties.</li> On the property sheet, click the Event tab, and then click Event Procedure in the OnClick list.</li>  Click the Build button and type the following line in the command button's OnClick procedure: SendKeys "^F"   ' note upper case "F" </li> Open the Customers form in Form view, and then click the command button.

Notice that the Find window does not appear and no beep is generated to indicate an invalid key combination.</li>  Open the Customers form in Design view, and then change the event procedure on the command button to the following: SendKeys "^f"   'Note the lower case "f" </li> Open the Customers form in Form view, and then click the command button.

Notice that the Find window now appears as expected.</li></ol>

<div class="references_section">