ACC: Invalid Reference to Field '<value>' Using SetValue Macro

Last reviewed: May 7, 1997
Article ID: Q96580
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SYMPTOMS

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

If the Expression argument of a SetValue macro action evaluates to a text expression beginning with a letter, you may receive the following error message when a SetValue macro action attempts to set the value of a control.

In Microsoft Access 7.0 and 97:

   ! The object doesn't contain the OLE Automation object '<value>'

In Microsoft Access 1.x and 2.0:

   ! Invalid reference to field '<value>'

CAUSE

An Expression argument of a SetValue macro action that begins with a leading equal sign (=) is understood to be a field name.

RESOLUTION

Remove the leading equal sign in the Expression argument.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create the following macro and save it as My Macro:

          Macro Name         Action
          ---------------------------
          My Macro           SetValue
    
          My Macro Actions
          -------------------------
          SetValue
             Item: Field0
             Expression: ="A023bbb"
    
    

  2. Create a new form not based on any table or query.

  3. Add a command button to the form by dragging the macro named My Macro from the Database window to the form.

  4. Add a text box to the form and set its Name property (or ControlName property in version 1.x) to Field0.

  5. Switch the form to Form view.

  6. Click the command button to run the macro. Note that you receive the following error message.

    In Microsoft Access 7.0 and 97:

          ! The object doesn't contain the OLE Automation Object 'A023bbb'
    

    In Microsoft Access 1.x and 2.0:

          ! Invalid reference to field 'A023bbb'
    

REFERENCES

For more information about the SetValue action, search the Help Index for "SetValue."


Keywords : kberrmsg kbusage McrArg
Version : 1.0 1.1 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 7, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.