Press Button - Changes Drop Down Menu Selection

  • Thread starter Thread starter The Boondock Saint
  • Start date Start date
T

The Boondock Saint

Is there a way you can link a button to a drop down list so that you can
tell it to select one of the options...

for example... press the button and it will select option 2 in the drop down
list...
 
Wouldn't that then require a separate button for each/every item in the
drop-down (combo box) list?

Wouldn't it be easier to just select the item on the list?

I don't understand why you might need to press a button to select a combo
box item?
 
The buttons also have other functions... such as calculations... and i just
want to be able to add the selection of a item on a dropdown list at the
same time...
 
In the code behind the button, you'll need to refer to the value selected in
the combo box, something like:

YourCalculationVariable = Me!cboYourComboBox

You may also wish to test to be sure that a value's been selected before
"using" it.
 
I think what you're looking for may be the ItemData property of the
ComboBox. It is a zero-based collection, so the first item is ItemData(0),
the second item is ItemData(1), etc. Here's an example ...

Private Sub Command2_Click()

'select first item in list
Me.Combo0.Value = Me.Combo0.ItemData(0)

End Sub

Private Sub Command3_Click()

'select second item in list
Me.Combo0.Value = Me.Combo0.ItemData(1)

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top