ACC97: How to Use the RefreshDatabaseWindow Method

Last reviewed: August 29, 1997
Article ID: Q160950
The information in this article applies to:
  • Microsoft Access 97

SUMMARY

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

When you create, delete, or rename an object through code while the object is visible in the Database window, the Database window does not reflect the changed object until the focus moves to a different object type and back again. For example, if you create a new table, and the Table tab is selected in the Database window, you may not see the new table until you click another tab in the Database window and then click the Table tab again.

This article demonstrates how to use the RefreshDatabaseWindow method of the Application object to refresh the Database window after you change an object.

This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications with Microsoft Access 97" manual.

MORE INFORMATION

You can use the RefreshDatabaseWindow method to immediately reflect changes to objects in the Database window, as the following example shows:

  1. Open the sample database Northwind.mdb.

  2. Select the Shippers table in the Database window.

  3. On the Edit menu, click Copy.

  4. On the Edit menu, click Paste. In the Paste Table As dialog box, type Shippers2 in the Table Name box, and then click OK.

  5. Create a module and type the following procedure:

          Function TestRefresh()
    
             Dim db As Database
             Set db = CurrentDb()
             db.TableDefs.Delete "Shippers2"
             Application.RefreshDatabaseWindow
          End Function
    
    

  6. Press F11 to bring the Database window to the foreground and click the Tables tab.

  7. Press CTRL+G to open the Debug window. Position the Database window and the Debug window so both are visible. Type the following line in the Debug window, and then press ENTER.

          ?TestRefresh()
    

    Note that the Shippers2 table is removed from the Database window.

REFERENCES

For more information about the RefreshDatabaseWindow method, search the Help Index for "RefreshDatabaseWindow method."

Keywords          : kbprg kbusage PgmHowTo SynFnc
Version           : 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbhowto


================================================================================


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: August 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.