ACC: Changing Control Properties Affects All Records in a Form

Last reviewed: May 28, 1997
Article ID: Q119992
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.

Changing a control's property setting (such as the BackColor property setting) in a continuous form causes all instances of that control in all records to be changed.

RESOLUTION

You may be able to use the Format property to alter the color of numeric data in a text box based on the data's value (positive, negative, zero, or null), instead of changing the control's property setting.

STATUS

This behavior is by design.

MORE INFORMATION

Microsoft Access stores a single set of property settings for each control on a form. In order for a control to appear differently from record to record on a form, Microsoft Access would have to store and maintain property settings for each control for every record in the form.

If a control has approximately 50 property settings, a form with 1000 records would need to maintain 50,000 property settings. Maintaining this much information for controls would severely impact performance.

Steps to Reproduce Behavior

  1. Open the sample database Northwind.mdb (or NWIND.MDB in Microsoft Access 1.x and 2.0)

  2. Create the following new macro and save the macro as Highlight:

          Macro Name   Action     Description
          --------------------------------------------------
          On           SetValue   Change BackColor to Yellow
          Off          SetValue   Change BackColor to White
    
          Highlight Actions
          ---------------------------------------------
          SetValue
             Item: [Screen].[ActiveControl].[BackColor]
             Expression: 8454143
          SetValue
             Item: [Screen].[ActiveControl].[BackColor]
             Expression: 16777215
    
    

  3. Create a new form based on the Customers table. Add three or four fields from the table to the form. Make sure the form's Default View property is set to Continuous Forms.

  4. On the View menu (or Edit menu in Microsoft Access 1.x and 2.0), click Tab Order. Note the name of the first control listed then close the dialog box. Set the following properties for every text box control on the form except the first control listed in the Tab Order dialog box:

          OnEnter: Highlight.On
          OnExit: Highlight.Off
    

  5. Save the form as Test.

  6. View the form in Form view. Use the TAB key to move among the controls on the form. Note that as you move from control to control, the BackColor property for all controls, not just the active control, is changed.

REFERENCES

For more information about using color in the Format property, search the Help Index for "Format Property," or ask the Microsoft Access 97 Office Assistant.


Keywords : FmsProp kbusage
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 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.