ACC2000: Running Code with RepaintObject on a Data Access Page Erases Recent Changes

ID: Q225976


The information in this article applies to:
  • Microsoft Access 2000

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

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


SYMPTOMS

When you run the RepaintObject method of the DoCmd object on a data access page, you may lose the most recent changes that you made to the design of the page.


CAUSE

The RepaintObject method reloads the page from the persisted state on disk.


RESOLUTION

Make sure that you either save the page or view the page in Page view before you run Visual Basic for Application code that contains the RepaintObject method.

Saving the Page

To manually save the page, click Save on the File menu.

-or-

To programmatically save the page, use a line similar to the following:

DoCmd.Save acDataAccessPage, "<pagename>" 

Viewing the Page in Page View

To manually view the page in Page view, click Page View on the View menu, and then click Design View on the View menu.

-or-

To programmatically view the page in Page view, use a line similar to the following:

DoCmd.OpenDataAccessPage, "<pagename>", acDataAccessPageBrowse 


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

Steps to Reproduce 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 OK.


  4. Add a command button to the page.


  5. On the File menu, click Save. Save the page as dapLostButton.


  6. Add a second command button to the page.


  7. Press CTRL+G to open the Immediate window in the Visual Basic Editor.


  8. Type the following line in the Immediate window, and then press ENTER:


  9. 
    DoCmd.RepaintObject acDataAccessPage, "dapLostButton" 
    Note that the second command button is no longer on the page.

Additional query words: pra gone missing lost

Keywords : kbdta AccDAP DAPProb
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: September 2, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.