Microsoft KB Archive/145773

= ACC: "SendKeys Requires Microsoft Access Utility Add-in" Error =

Article ID: 145773

Article Last Modified on 1/19/2007

-

APPLIES TO


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

-



This article was previously published under Q145773



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

When you carry out a SendKeys macro action, you may receive the following error message:

The SendKeys action requires the Microsoft Access Utility Add-in to be loaded.

  Solution Run Setup to reinstall Microsoft Access and the Microsoft Access Utility Add-in.



CAUSE
The Keystrokes argument of the SendKeys action has incorrect syntax. For example, you may have enclosed the Keystrokes argument in quotation marks ("), entered incorrect syntax, or misspelled some text.

If you receive the error message after converting a database created in an earlier version of Microsoft Access, the specified keystrokes may not work in Microsoft Access 7.0. or 97. Or, the Keystrokes argument may have been enclosed in quotation marks which was not required in earlier versions but was permitted. In Microsoft Access 7.0 and 97, however, you cannot enclose the Keystrokes argument of a SendKeys macro action in quotation marks.

You may also receive this error message when you use any of the following characters in the Keystrokes property of the SendKeys action:

plus sign (+)

caret (^)

percent sign (%)

tilde (~)

parentheses

The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses have special meanings to SendKeys. To specify one of these characters, enclose it in braces. For example, to specify the plus sign, use {+}.



RESOLUTION
Open the macro in Design view and fix the Keystrokes argument as necessary. For example, remove any quotation marks, correct a misspelling, or fix any syntax errors.

NOTE: If you want to include a quotation mark as one of the keystrokes used by the SendKeys macro action, you need to enter two sets of quotation marks in the Keystrokes argument, as follows:

  Macro1 --  SendKeys Keystrokes: ""Building Applications with Microsoft Access"" Wait: No

-or-

Macro2 --  SendKeys Keystrokes: Michael ""Mick"" Suyama Wait: No



MORE INFORMATION
NOTE: If you use a SendKeys action to carry out menu commands or fill-in dialog boxes, you may want to find an alternative method for the action. The SendKeys' keystrokes may not work in future versions of Microsoft Access because the user interface may change. Depending on your purpose for using SendKeys, you may want to try one of the following methods:


 * If you want to set a field to a specific value, try using a SetValue action in a macro or set it directly in Visual Basic. For more information about the SetValue macro action, search the Help Index for "SetValue action," or ask the Microsoft Access 97 Office Assistant.
 * If you want to carry out a menu command, try using a RunCommand action or a RunCommand method (or a DoMenuItem action or a DoMenuItem method in Microsoft Access 7.0), in Visual Basic for Applications. For more information about the RunCommand macro action, search the Help Index for "RunCommand Action." For more information about the DoMenuItem macro action, search the Help Index for "DoMenuItem action."

NOTE: In Microsoft Access 97, the DoMenuItem method and the DoMenuItem action have been replaced by the RunCommand method and the RunCommand action. They are included in Microsoft Access 97 for compatibility with earlier versions.
 * If you want to fill in dialog boxes, try running the equivalent method in Visual Basic (if one exists) and setting any arguments that correspond to the dialog box options.
 * If you want to activate another application from Microsoft Access, try using Automation or dynamic data exchange (DDE) (if supported by the other program). For more information about Automation (or DDE), search the Help Index for "OLE" or "DDE," and then view the available topics.

Steps to Reproduce Behavior
CAUTION: Following the steps in this example will modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file or perform these steps on a copy of the Northwind database.

 Open the sample database Northwind.mdb.  Create a new macro as follows:

     Macro Name   Macro Action -     FillField    GotoControl SendKeys

FillField Actions ---     GotoControl ControlName: Text0 SendKeys Keystrokes: "Sample text for SendKeys." Wait: No                        Close the macro and save it as FillField. Create a form not based on any table or query in Design view.</li>  Add the following two controls to the form:

<pre class="fixed_text">     Form: Form1 ---     Text box: Name: Text0 Width: 3 in. Command button: Name: Button0 Caption: Fill Field </li> Set the command button's OnClick property to the FillField macro.</li> View the form in Form view.</li> Click the Fill Field button. Note that you receive the error message mentioned in the "Symptoms" section.</li></ol>

<div class="references_section">