Difference between revisions of "Microsoft KB Archive/252744"

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 128: Line 128:
 
   Dim cmdControl As CommandBarControl
 
   Dim cmdControl As CommandBarControl
  
   Set cmdBar = CommandBars("Test")
+
   Set cmdBar = CommandBars("Test")
  
 
   For Each cmdControl In cmdBar.Controls
 
   For Each cmdControl In cmdBar.Controls
 
       If cmdControl.Type = 4 Then
 
       If cmdControl.Type = 4 Then
 
         cmdControl.SetFocus
 
         cmdControl.SetFocus
         SendKeys "{Down}", True
+
         SendKeys "{Down}", True
 
       End If
 
       End If
 
   Next cmdControl
 
   Next cmdControl
Line 149: Line 149:
 
<li><p>Set the '''OnOpen''' property of the form to the following event procedure:</p>
 
<li><p>Set the '''OnOpen''' property of the form to the following event procedure:</p>
 
<pre class="codesample">Private Sub Form_Load(Cancel As Integer)
 
<pre class="codesample">Private Sub Form_Load(Cancel As Integer)
   Set focusBar = CommandBars.Add(Name:=&quot;Test&quot;)
+
   Set focusBar = CommandBars.Add(Name:="Test")
   With CommandBars(&quot;Test&quot;)
+
   With CommandBars("Test")
 
       .Visible = True
 
       .Visible = True
 
       .Position = msoBarTop
 
       .Position = msoBarTop
 
   End With
 
   End With
  
   Set testComboBox = CommandBars(&quot;Test&quot;).Controls. _
+
   Set testComboBox = CommandBars("Test").Controls. _
 
       Add(Type:=msoControlComboBox, Id:=1)
 
       Add(Type:=msoControlComboBox, Id:=1)
  
 
   With testComboBox
 
   With testComboBox
     .AddItem &quot;First Item&quot;, 1
+
     .AddItem "First Item", 1
     .AddItem &quot;Second Item&quot;, 2
+
     .AddItem "Second Item", 2
 
   End With
 
   End With
 
End Sub
 
End Sub
Line 167: Line 167:
 
<pre class="codesample">Private Sub Form_Unload(Cancel As Integer)
 
<pre class="codesample">Private Sub Form_Unload(Cancel As Integer)
 
   For Each cmdBar In CommandBars
 
   For Each cmdBar In CommandBars
       If cmdBar.Name = &quot;Test&quot; Then
+
       If cmdBar.Name = "Test" Then
 
         cmdBar.Delete
 
         cmdBar.Delete
 
       End If
 
       End If

Latest revision as of 13:52, 21 July 2020

Knowledge Base


Article ID: 252744

Article Last Modified on 10/11/2006



APPLIES TO

  • Microsoft Access 2000 Standard Edition



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).


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.

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)


STATUS

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

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.



Additional query words: pra msaccess exe

Keywords: kbbug kberrmsg kbpending kbprogramming KB252744