Microsoft KB Archive/160950

= ACC97: How to Use the RefreshDatabaseWindow Method =

Article ID: 160950

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q160950



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



SUMMARY
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 then 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 shows you 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:  Open the sample database Northwind.mdb. Select the Shippers table in the Database window. On the Edit menu, click Copy. On the Edit menu, click Paste. In the Paste Table As dialog box, type Shippers2 in the Table Name box, and then click OK.  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  Press F11 to bring the Database window to the foreground and click the Tables tab.</li> 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.</li></ol>

<div class="references_section">