Microsoft KB Archive/295176

= ACC2002: RepaintObject Command Removes Objects from an Unsaved Data Access Page =

Article ID: 295176

Article Last Modified on 9/27/2006

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q295176



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

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



SYMPTOMS
When you use the RepaintObject method or action, all objects that you added to a data access page since you last save the page are lost.



CAUSE
The RepaintObject command reloads the page from the persisted copy of the page, which does not include unsaved objects.



RESOLUTION
Save the data access page before you use the RepaintObject method or action.



Steps to Reproduce the Behavior
CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

 Open the sample database, Northwind.mdb. On the View menu, point to Database Objects, and then click Pages. Click New. In the New Data Access Page dialog box, click Design View, click the Customers table in the Choose the table or query where the object's data comes from box, and then click OK. In the field list, right-click the CompanyName field, and then click Add To Page on the shortcut menu.</li> Save the page as DAPtest.htm .</li> In the field list, right-click the ContactName field, and then click Add To Page on the shortcut menu.</li> Press CTRL+G to open the Immediate window.</li>  Type the following line in the Immediate Window, and then press ENTER: DoCmd.RepaintObject </li> Note that the CompanyName text box is displayed on the page, but that the ContactName text box is removed.</li></ol>

Additional query words: prb

Keywords: kbdap kbnofix kbprb KB295176

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.