ACC: "Invalid Bracketing of Name <Expression Object>" Error

Last reviewed: May 21, 1997
Article ID: Q132184
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 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:

    In Microsoft Access 97:

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

    In Microsoft Access 2.0 and 7.0:

       'Forms![FormName]![Control.Name]' isn't a valid parameter name.

CAUSE

The Where Condition argument references a form control containing a dot (.) or an exclamation (!) 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 Microsoft 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 any punctuation mark except the underscore character.

Steps to Reproduce Behavior

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

  2. 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 ( or Customer Mailing Labels in
                                            Microsoft Access 2.0)
             View: Print Preview
             Where Condition: [CustomerID]=Forms![Customers2]![Cust.ID]
    
       NOTE: [Customer ID] contains a space in Microsoft Access 2.0.
    
    

  3. Make a copy of the Customers form and saved it as Customers2.

  4. Open the Customers2 form in Design view.

  5. Select the CustomerID control and change its Name property to Cust.ID.

  6. Add a command button to the Customers2 form and set the following properties:

          Command Button:
    
             Name: Button1
             Caption: Print Label
             OnClick: Print Label Macro
    
    

  7. View the Customers2 form in Form view.

  8. Click the Print Label Button. In the Country Filter dialog box, click All Countries, and then click OK. Note that you receive the error message mentioned in the "Symptoms" section.

REFERENCES

For more information about the dot and exclamation point operators, search for "identifiers and expressions," and then "Use the ! and . (dot) operators in expressions" using the Microsoft Access 97 Help Index.


Keywords : kberrmsg kbusage SynRef
Version : 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


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: May 21, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.