ACC: Dropdown Method of Combo Box Not Working in Form Load Event

Last reviewed: February 16, 1998
Article ID: Q181078
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

  1. Create a subform whose DefaultView property is set to Continuous Forms and whose ViewsAllowed property is set to Both.

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

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

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

  1. Start Microsoft Access and open the sample database Northwind.mdb.

  2. Create a new form that is not bound to any table or query.

  3. Use the Subform/Subreport Wizard to add Customer Orders Subform 2 to the form.

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

  5. Set the OnLoad property of the form to the following event procedure:

          Private Sub Form_Load()
    

             Me![ctlDropCombo].SetFocus
             Me![ctlDropCombo].Dropdown
    
          End Sub
    
    

  6. Save the form as frmNoDrop and close it.

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


Additional query words: pra expand
Keywords : FmsCmbo FmsEvnt
Version : WINDOWS:7.0,97
Platform : WINDOWS
Hardware : x86
Issue type : kbbug
Solution Type : kbpending


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 16, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.