Microsoft KB Archive/304256

= ACC2000: RefreshDatabaseWindow Method Does Not Work in an Access Project (ADP) =

Article ID: 304256

Article Last Modified on 6/28/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q304256



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

This article applies only to a Microsoft Access project (.adp).



SYMPTOMS
The RefreshDatabaseWindow method in an Access project does not work.



RESOLUTION
To work around this behavior, call the Execute method of the CommandBarControl object. The following is sample code to do so: Private Sub Command0_Click 'Requires reference to Office 9.0 object library. Dim strSQL As String Dim cBars As Office.CommandBars Dim cBarCtl As Office.CommandBarControl strSQL = &quot;CREATE TABLE Test (ID varchar(5) PRIMARY KEY NOT NULL)&quot; CurrentProject.Connection.Execute strSQL DoCmd.SelectObject acTable,, True Set cBars = Application.CommandBars Set cBarCtl = cBars.FindControl(msoControlButton, 3812) If Not cBarCtl Is Nothing Then cBarCtl.Execute End If End Sub



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce the Behavior
 Open the sample Access project NorthwindCS.adp. Create a new form.  Add a command button to the form, and then set the OnClick property of the command button to the following event procedure: Private Sub Command0_Click Dim strSQL As String strSQL = &quot;CREATE TABLE Test (ID varchar(5) PRIMARY KEY NOT NULL)&quot; CurrentProject.Connection.Execute strSQL DoCmd.SelectObject acTable,, True Application.RefreshDatabaseWindow End Sub Note that the Database window is not refreshed. 

Additional query words: pra

Keywords: kbbug kbpending KB304256

-

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

© Microsoft Corporation. All rights reserved.