472,127 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

Combo box for more than one field

I have a table (tblParts) containing Description and PartNumber fields.
I have an input form for another table containing the same fields.

I am using tblParts as the row source for a combo box on the input form for
the second table.

I would like to be able to select an item from the Description field of the
combo box and have it update both fields in the input form.

Any help will be greatly appreciated.
Nov 12 '05 #1
2 4927
You can refer to the individual columns in the selected row of the combobox
as Me.MyCombo.Column(n), where n is 0 to 1 less than the number of columns
in the combobox MyCombo.

So if you've bound the first column (column 0) to one field in your form, in
the AfterUpdate event of the combo, you can put code like:

Private Sub MyCombo_AfterUpdate

Me.MyOtherTextBox = Me.MyCombo.Column(1)

End Sub

to populate a textbox named MyOtherTextBox with the value of the second
column.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
"Bob Sanderson" <xn***@LUVSPAMsandmansoftware.com> wrote in message
news:Xn**********************************@167.206. 3.2...
I have a table (tblParts) containing Description and PartNumber fields.
I have an input form for another table containing the same fields.

I am using tblParts as the row source for a combo box on the input form for the second table.

I would like to be able to select an item from the Description field of the combo box and have it update both fields in the input form.

Any help will be greatly appreciated.

Nov 12 '05 #2
"Douglas J. Steele" <dj******@canada.com> wrote in
news:EG*******************@news02.bloor.is.net.cab le.rogers.com:
You can refer to the individual columns in the selected row of the
combobox as Me.MyCombo.Column(n), where n is 0 to 1 less than the
number of columns in the combobox MyCombo.

So if you've bound the first column (column 0) to one field in your
form, in the AfterUpdate event of the combo, you can put code like:

Private Sub MyCombo_AfterUpdate

Me.MyOtherTextBox = Me.MyCombo.Column(1)

End Sub

to populate a textbox named MyOtherTextBox with the value of the
second column.


That did it, thanks.
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Sean | last post: by
10 posts views Thread by Bob Darlington | last post: by
2 posts views Thread by fredloh | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.