Microsoft KB Archive/208961

= ACC2000: Changing Control Properties Affects All Records in a Form =

Article ID: 208961

Article Last Modified on 6/28/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q208961



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



SYMPTOMS
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
If you want to change the control's property for the active control only, use conditional formatting.

To change the color of the active control with conditional formatting, follow these steps:
 * 1) Open the form in Design View.
 * 2) On the Format menu, click Conditional Formatting.
 * 3) Under Condition 1, click Field Has Focus.
 * 4) Change the BackColor or other properties with the formatting toolbar.



MORE INFORMATION
Microsoft Access stores a single set of property settings for each control on a form. In order for a control to appear different 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
 Open the sample database Northwind.mdb.  Create the following new macro and save the macro as Highlight:   Macro Name   Action     Comment --  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  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 DefaultView property is set to Continuous Forms.  On the View menu, click Tab Order. Note the name of the first control listed, and 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  Save the form as Test.</li> View the form in Form view. Use the TAB key to move from control to control 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.</li></ol>

<div class="references_section">