Microsoft KB Archive/96580

= ACC: Invalid Reference to Field ' ' Using SetValue Macro =

Article ID: 96580

Article Last Modified on 1/18/2007

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q96580



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



SYMPTOMS
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 ' '

In Microsoft Access 1.x and 2.0:

! Invalid reference to field ' '



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.



Steps to Reproduce Behavior
  Create the following macro and save it as My Macro:

     Macro Name         Action ---     My Macro           SetValue

My Macro Actions -     SetValue Item: Field0 Expression: =&quot;A023bbb&quot;  Create a new form not based on any table or query. Add a command button to the form by dragging the macro named My Macro from the Database window to the form. Add a text box to the form and set its Name property (or ControlName property in version 1.x) to Field0. Switch the form to Form view.</li> 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'

</li></ol>

<div class="references_section">