Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Activating a Commandbar Drop-Down List Causes an Abnormal Program Termination


View products that this article applies to.

This article was previously published under Q252744
Advanced: Requires expert coding, interoperability, and multiuser skills.

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

↑ Back to the top


Symptoms

When you activate a commandbar drop-down list, you may receive one of the following error messages:
If you are running Microsoft Windows 95 or Microsoft Windows 98:

You see the following Microsoft Visual C++ Runtime Library error message:
Runtime error

Program C:\Progra~1\Micros~1\Office\Msaccess.exe

abnormal program termination
If you are running Microsoft Windows NT:

Access appears to stop responding for a few seconds, and then you see the following error message:
MSACCESS.exe has generated errors and will be closed by Windows. You will need to restart the program.

An Error log is being created.

↑ Back to the top


Resolution

To resolve this problem, obtain Microsoft Office 2000 Service Release 1/1a (SR-1/SR-1a).

To obtain SR-1/SR-1a, click the article number below to view the article in the Microsoft Knowledge Base:
245025� OFF2000: How to Obtain and Install Microsoft Office 2000 Service Release 1/1a (SR-1/SR-1a)

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in Access. This problem was corrected in Microsoft Office 2000 SR-1/SR-1a.

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Create a new database.
  2. Create a new form and save it as frmCommand.
  3. Open the frmCommand form in Design view.
  4. Create a command button in the form footer, and then set its properties as follows:
    Name: cmdDropdown
    Caption: Open Command Bar Dropdown
    OnClick: [Event Procedure]
  5. Set the OnClick property of the command button to the following event procedure:
    Private Sub cmdDropdown_Click()
       Dim cmdBar As CommandBar
       Dim cmdControl As CommandBarControl
    
       Set cmdBar = CommandBars("Test")
    
       For Each cmdControl In cmdBar.Controls
          If cmdControl.Type = 4 Then
             cmdControl.SetFocus
             SendKeys "{Down}", True
          End If
       Next cmdControl
    End Sub
    					
  6. In the Visual Basic Editor, click References on the Tools menu, and make sure the following reference is selected:
    Microsoft Office 9.0 Object Library
    NOTE: You may have to scroll through the references to find it.

    This references the CommandBars object and its properties.
  7. Set the OnOpen property of the form to the following event procedure:
    Private Sub Form_Load(Cancel As Integer)
       Set focusBar = CommandBars.Add(Name:="Test")
       With CommandBars("Test")
          .Visible = True
          .Position = msoBarTop
       End With
    
       Set testComboBox = CommandBars("Test").Controls. _
          Add(Type:=msoControlComboBox, Id:=1)
    
       With testComboBox
         .AddItem "First Item", 1
         .AddItem "Second Item", 2
       End With
    End Sub
    					
  8. Set the OnUnload property of the form to the following event procedure:
    Private Sub Form_Unload(Cancel As Integer)
       For Each cmdBar In CommandBars
          If cmdBar.Name = "Test" Then
             cmdBar.Delete
          End If
       Next cmdBar
    End Sub
    					
  9. Run the form and click the button. Note that you encounter the symptoms described in the Symptoms section of this article.

    NOTE: In Windows NT, it may take a few seconds to see the error message.

↑ Back to the top


Keywords: KB252744, kbprogramming, kbpending, kberrmsg, kbbug

↑ Back to the top

Article Info
Article ID : 252744
Revision : 3
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 305