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!

Help!!!!!!!!!! Combo Box is not working......

Status
Not open for further replies.

jdwm2310

Technical User
Jul 26, 2001
396
0
0
US
Hi,

I have a combo box row source type is a value list and there are two columns. When I go to form view i see both columns and it's data, but when I select an item from the combo box the first column is only entered into the field. What am I doing wrong, I am probably overlooking something...
 
I have seen this also, & it happens when they are bound to underlying lookup fields as well...

It looks like you can select something based upon multiple columns, but only 1 is stored. Perhaps you could change the bound column to 1 & 2??? James Goodman
 
Hi!

Your combo box has a property called bound column. This is initially set to 1 to bind whatever is in the first column to the underlying table. Access will not let you bind both columns since it will only store one value in the table. If you want the second column to be stored set the bound column to 2. If you need to store both columns the recommended method is to store them in separate fields using the after update event of the combo box:

Dim intRow As Integer

intRow = Me.ComboBox.ListIndex
Me!YourFirstField = Me!ComboBox.Column(0, intRow)
Me!YourSecondField = Me!ComboBox.Column(1, intRow)

In the less likely event that you are planning on concatenating the columns and storing them in one field then use:

Dim intRow As Integer

intRow = Me.ComboBox.ListIndex
Me!YourField = Me!ComboBox.Column(0, intRow) & Me!YourSecondField = Me!ComboBox.Column(1, intRow)

Making sure that the fields in question are part of the recordset of the form even if you are not displaying them.

hth
Jeff Bridgham
bridgham@purdue.edu
 
I wouldn't change the bound column value as this is the value stored in your table, usually the foreign key (Primary Key of other table.)

You could place a text box next to you bound combo-box which displays column 2 from you combo-box.
 
what if i try to associate a field with another field. For example:
(field name) Name of Employee: Diana
(field name) Employee id: 32552

So if I enter Diana the employee id will automatically be inserted in the field name Employee id...
 
Hi jdwm2310!

If you are having trouble with the method I was describing, you can send me an email letting me know what sort of method you want to see and I can send you a Db back that will demonstrate how it can be accomplished. If you want to see how to populate bound text boxes with the data from the combo box, we can do that also. Let me know if I can help.

Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top