ACC2000: Controls Are Not Automatically Rebound After You Change the RecordSource Property (203179)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q203179
Novice: Requires knowledge of the user interface on single-user computers.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SYMPTOMS

When you change the RecordSource property of a data access page that has bound controls, the controls on that page are unbound. If you then reset the RecordSource property of that same page to the original value, the controls are not automatically rebound to their original ControlSource property value. To rebind the controls, you must manually reset each control on the page.

For example, if you have a properly functioning page that is bound to a table named Employees, and you change the RecordSource property to Customers, and then back to Employees, the controls on that page will display the #Name? value. The ControlSource property for each control on the page will be set to a valid field name in the Employees table, but because they are not automatically rebound to the recordset, it will appear as though the controls are not bound properly.

CAUSE

A new recordset is created each time that you change the RecordSource property. The values in the ControlSource properties are not retained and rebound when the new record set is created.

RESOLUTION

To work around this problem, do the following for each of the bound controls:
  1. Select the control.
  2. If the property sheet is not displayed, click Properties on the View menu, and then click the Data tab.
  3. If the field is bound to a column, select the column from the ControlSource list.

    If the field is bound to an expression, retype the expression in the ControlSource property box.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Open the sample database Northwind.mdb.
  2. In the Database window, click Pages under Objects, and then click New.
  3. In the New Data Access Page dialog box, click AutoPage: Columnar, click Customers in the Choose the table or query where the object's data comes from box, and then click OK.
  4. On the View menu, click Design View.
  5. If the property sheet is not displayed, on the View menu, click Properties, and then click the Data tab.
  6. Double-click Header: Customers on the page.
  7. Change the RecordSource property to Table: Orders.
  8. On the View menu, click Page View.

    Note that all the controls, with the exception of CustomerID, contain "#Name?".
  9. On the View menu, click Design View.
  10. Double-click Header: Orders on the page.
  11. Change the RecordSource property to Table: Customers.
  12. On the View menu, click Page View.

    Note that all the controls, with the exception of CustomerID, still contain "#Name?".

Modification Type:MinorLast Reviewed:7/16/2004
Keywords:kbDAP kbprb KB203179