Microsoft KB Archive/252744: Difference between revisions
(importing KB archive) |
m (Text replacement - """ to """) |
||
Line 128: | Line 128: | ||
Dim cmdControl As CommandBarControl | Dim cmdControl As CommandBarControl | ||
Set cmdBar = CommandBars( | 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 | 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:= | Set focusBar = CommandBars.Add(Name:="Test") | ||
With CommandBars( | With CommandBars("Test") | ||
.Visible = True | .Visible = True | ||
.Position = msoBarTop | .Position = msoBarTop | ||
End With | End With | ||
Set testComboBox = CommandBars( | Set testComboBox = CommandBars("Test").Controls. _ | ||
Add(Type:=msoControlComboBox, Id:=1) | Add(Type:=msoControlComboBox, Id:=1) | ||
With testComboBox | With testComboBox | ||
.AddItem | .AddItem "First Item", 1 | ||
.AddItem | .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 = | If cmdBar.Name = "Test" Then | ||
cmdBar.Delete | cmdBar.Delete | ||
End If | End If |
Latest revision as of 13:52, 21 July 2020
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:
If you are running Microsoft Windows NT:
Access appears to stop responding for a few seconds, and then you see the following error message:
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
- Create a new database.
- Create a new form and save it as frmCommand.
- Open the frmCommand form in Design view.
- 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] 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
- 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.
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
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
- 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