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!

Combo Box column problem

Status
Not open for further replies.

Nelz

Programmer
Sep 27, 2001
50
0
0
US
I have a combo box that displays peoples names, as well as their ID numbers. When the user selects a person from the list (only their names are displayed) I want to have their name entered in the [OrderPerson] field of the order, and their number entered in the [OrderPersonID] field. Currently I have it working to only enter the name, and I just checked and I really need the ID number too. Can you bind more than one column? Or how would you do that?
 
Nelz:

You can access each column of data in a combo box with the following syntax:
Code:
<combo box name>.Column(<column index number>)
Just remember that Access starts indexing the columns at 0, and not 1 - so if you need the first column, it's:
Code:
<combo box name>.Column(0)
PS: If you refer to just the combo box name with no .Column property after, you retrieve the value that the combo box is bound to.

HTH


Greg Tammi, IT Design & Consultation
Work: Home:
 
OK, so basically what I did was to add a field to the form for OrderPersonID .....then I put in the OnClick event of the combo box

Private Sub OrderPersonID_Click()
Me![Text144] = [OrderPersonID].[Column](0)
End Sub

Text144 is the text field for the OrderPersonID . Its confusing, because the combo box is called OrderPersonID even though its Data source is OrderPerson....because I am bound to the name field and not the number. I basically did that a couple of years ago when I thought there would really be no need to number these people, but I was wrong.

I have learned to keep things clean and simple.

Thanks for pointing me in the right direction!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top