Microsoft KB Archive/208810

= ACC2000: "Invalid Bracketing of Name " Error =

Article ID: 208810

Article Last Modified on 7/16/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q208810



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



SYMPTOMS
When you run an ApplyFilter, OpenForm, or OpenReport action using a macro or custom function with a Where Condition argument, you may receive an error message such as the following:

Invalid bracketing of name '[Forms]![FormName]![Control.Name]'



CAUSE
The Where Condition argument references a form control containing a dot (.) or an exclamation point (!) in its name.



RESOLUTION
Rename the control and omit the dot or the exclamation point.



MORE INFORMATION
The dot (.) and the exclamation point (!) have a special meaning in Microsoft Access. They are identifier operators you use to refer to objects, controls, collections, or properties as follows:

Forms![FormName]![ControlName].property

If you include a dot or an exclamation point in a field name or control name, then Access may not be able to interpret the reference when you use it in an expression or in a Where Condition argument.

To prevent reference problems, use letters, numbers, spaces, or the underscore character (_) when you assign object names; do not use punctuation marks except the underscore character.

Steps to Reproduce Behavior
 Open the sample database Northwind.mdb.  Create the following new macro and save it as Print Label Macro:      Macro Name          Action --     Print Label Macro   OpenReport

Print Label Macro Actions --     OpenReport Report Name: Customer Labels View: Print Preview Where Condition: [CustomerID]=Forms![Customers2]![Cust.ID]  Make a copy of the Customers form and saved it as Customers2. Open the Customers2 form in Design view.</li> Select the CustomerID control and change its Name property to Cust.ID.</li>  Add a Command Button to the Customers2 form and set the following properties: <pre class="fixed_text">     Command Button: Name: Button1 Caption: Print Label OnClick: Print Label Macro </li> View the Customers2 form in Form view.</li> Click the Print Label button. Note that you receive the error message mentioned in the "Symptoms" section.</li></ol>

<div class="references_section">