Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Many Combo-box drop down in a form?

Status
Not open for further replies.

BennyWong

Technical User
May 19, 2002
86
0
0
US
Hello All,
I am using Access 2000. I am working on a form where
there is a bunch of combo-boxes. I am able to make one of the combo-box to drop down in the on enter event. Here is the code that I use to do this:

Private Sub Combo72_Enter()
Me.ActiveControl.Dropdown
End Sub

I know that I can do this for each of the combo-boxes
however, since I am learning VBA how can I do this for all of the combo-boxes on the form? I was wondering if I could either create a procedure by listing all the combo-boxes and when the user enter the combo-box the on_enter event will trigger the code:

Me.ActiveControl.Dropdown

or do I create a function that I could reference and be able to use it in all of my other forms? Any advice or help is appreciated in advance. Thank you very much for your time.

 
something like this:

Dim ctl As Control

For Each ctl In Me.Controls
If TypeOf ctl Is ComboBox Then
ctl.Dropdown
End If
Next ctl

Transcend
[gorgeous]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top