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

ID: Q96580


The information in this article applies to:


SYMPTOMS

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

If the Expression argument of a SetValue macro action evaluates to a text expression that begins with a letter, you may receive the following error message when a SetValue macro action tries 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 
Issue type        : kbprb 

Last Reviewed: March 20, 1999