select combobox value form 2nd column

M

mcnewsxp

i need to show the value from the 2nd column if my combobox.
i'll be matching a string value to the 2nd column.
how to?
tia,
mcnewsxp
 
S

Stuart McCall

mcnewsxp said:
i need to show the value from the 2nd column if my combobox.
i'll be matching a string value to the 2nd column.
how to?
tia,
mcnewsxp

For code running in the form's module:

strVar = Me.ComboName.Column(1)

For code running in a separate module:

strVar = Forms!FormName!ComboName.Column(1)

Listbox and combobox columns are zero-based arrays, so 1 = 2nd column.
 
M

Marshall Barton

mcnewsxp said:
i need to show the value from the 2nd column if my combobox.
i'll be matching a string value to the 2nd column.
how to?


More details please.

Check the BoundColumn and ColumnWidths properties in VBA
Help. OTOH, maybe you want to use the Column property?
 
M

mcnews

For code running in the form's module:

strVar = Me.ComboName.Column(1)

For code running in a separate module:

strVar = Forms!FormName!ComboName.Column(1)

Listbox and combobox columns are zero-based arrays, so 1 = 2nd column.

i need the opposite
forms!FormName!ComboBoxName.<selection> = me.ControlName.Value
where ControlName Value would be equal to on of the values in the 2nd
column of the conmbobox.
 

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

Top