The information in this article applies to:
- Microsoft Access versions 7.0, 97
SYMPTOMS
Moderate: Requires basic macro, coding, and interoperability skills.
When you use the Dropdown method of a combo box in the Load event of a
form, the combo box list does not automatically drop down when the form
opens.
CAUSE
The form contains a subform that is displayed in Datasheet view.
RESOLUTION
Use one of the following methods to work around this problem.
Method 1
Invoke the Dropdown method of the combo box in the Open event instead of in
the Load event.
Method 2
- Create a subform whose DefaultView property is set to Continuous Forms
and whose ViewsAllowed property is set to Both.
- In Design view of the main form that contains the combo box, set the
SourceObject property of the subform control to the form that you
created in step 1.
- Create another form, which will serve as the subform that you want to
display on the main form. Set its DefaultView and ViewsAllowed
properties to Datasheet.
- Set the OnLoad property of the form to the following event procedure:
Private Sub Form_Load()
Me![ctlDropCombo].SetFocus
Me![ctlDropCombo].Dropdown
Me![ContinuousSub].SourceObject = "DatasheetSub"
End Sub
This event procedure assumes that the name of your combo box is
ctlDropCombo, the name of your subform control is ContinuousSub, and the
name of the subform that you created in step 3 is DatasheetSub. Adjust the
code to reflect the names of the combo box, the subform control, and the
datasheet subform in your application.
Method 3
Use a subform whose DefaultView property is set to Continuous Forms.
STATUS
Microsoft has confirmed this to be a problem in Microsoft Access versions
7.0 and 97. We are researching this problem and will post new information
here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Note that this behavior does not occur when you open the form in Form view
directly from Design view.
Steps to Reproduce Problem
- Start Microsoft Access and open the sample database Northwind.mdb.
- Create a new form that is not bound to any table or query.
- Use the Subform/Subreport Wizard to add Customer Orders Subform 2 to the
form.
- Add a combo box called ctlDropCombo to the form. Set its properties as
follows:
Name: ctlDropCombo
Row Source Type: Value List
Row Source: a;b;c
- Set the OnLoad property of the form to the following event procedure:
Private Sub Form_Load()
Me![ctlDropCombo].SetFocus
Me![ctlDropCombo].Dropdown
End Sub
- Save the form as frmNoDrop and close it.
- Open the form in Form view from the Database window. Note that the
combo box list does not automatically drop down as expected.
REFERENCES
For more information, search the Help Index for "Dropdown method."