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!

Selecting Combo Box Value from Another Form

Status
Not open for further replies.

HardingR2000

Programmer
Oct 6, 2008
40
0
0
US
I have FormA with ComboBoxA and a command button which takes me to FormB. ComboBoxA has TableA as a record source. FormB allows me to make a new entry into TableA. When I return (close) from FormB I want FormB to set ComboBoxA's value to the value I just created on FormB.

In the close process for FormB I have tried:

Forms!FormA!ComboBoxA = <new value created by FormB>

and several other variations. Nothing works.

Any suggestions?
 
Have you experimented with the combo's .Value property?

Cogito eggo sum – I think, therefore I am a waffle.
 
Yes, I have tried:

Forms!FormA!ComboBoxA.value = <new value created by FormB>
and
Forms!FormA!ComboBoxA.column(0) = <new value created by FormB>
 
Maybe this?
You can use the ListIndex property to determine which item is selected in a list box or combo box.

Setting

The ListIndex property is an integer from 0 to the total number of items in a list box or combo box minus 1. Microsoft Access sets the ListIndex property value when an item is selected in a list box or list box portion of a combo box. The ListIndex property value of the first item in a list is 0, the value of the second item is 1, and so on.

This property is available only by using a macro or Visual Basic. You can read this property only in Form view and Datasheet view. This property is read-only and isn't available in other views.

Remarks

The ListIndex property value is also available by setting the BoundColumn property to 0 for a combo box or list box. If the BoundColumn property is set to 0, the underlying table field to which the combo box or list box is bound will contain the same value as the ListIndex property setting.

List boxes also have a MultiSelect property that allows the user to select multiple items from the control. When multiple selections are made in a list box, you can determine which items are selected by using the Selected property of the control. The Selected property is an array of values from 0 to the ListCount property value minus 1. For each item in the list box the Selected property will be True (–1) if the item is selected and False (0) if it is not selected.

The ItemsSelected collection also provides a way to access data in the selected rows of a list box or combo box.

Cogito eggo sum – I think, therefore I am a waffle.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top