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



The information in this article applies to:

  • Microsoft Access 2000

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 = "CREATE TABLE Test (ID varchar(5) PRIMARY KEY NOT NULL)"
    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.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Open the sample Access project NorthwindCS.adp.
  2. Create a new form.
  3. 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 = "CREATE TABLE Test (ID varchar(5) PRIMARY KEY NOT NULL)"
        CurrentProject.Connection.Execute strSQL
        DoCmd.SelectObject acTable, , True
        Application.RefreshDatabaseWindow
    End Sub
    						
    Note that the Database window is not refreshed.

Modification Type:MajorLast Reviewed:6/28/2004
Keywords:kbbug kbpending KB304256