Combo box will only select first option

leahb747

Registered User.
Local time
Today, 09:19
Joined
Jun 12, 2012
Messages
30
Hi all,

I'm having some issues with a combo box selection. I know I've had this issue before but I can't for the life of me remember how I've solved it.

My form is frmContacts, it's record source is tblContacts. tblContacts has the following columns - CompanyName (PK), ContactName (PK), ContactPosn (PK), ContactPhone, ContactEmail, ContactPerson, DateEnt. As you can see I have indexed it so there are 3 primary keys to prevent double entries.

The combo box I'm having trouble with shows three columns Name, Dept, Address from the Row Source tblCompany. The Control Source is CompanyName from tblContacts. This is bound to Name (so column 1), and then I have two text boxes to show the Dept and Address (=[CompanyName].[Column](1) and (2) etc). The remainder of form is updateable text boxes.

The issue I'm having is that despite my combo box showing all of the options for Name, Dept and Address, any option I select just defaults to the very first option.

Any help would be greatly appreciated

Leah
 
Whilst a Combo will show a number of fields when in the Drop Down state, it will only show the first field once the selection has been made. You can populate unbound text boxes with the other fields, relating to the current selection, by using;
Code:
=Me.ComboName.Column([B][COLOR="Red"]X[/COLOR][/B])
Where X represents the column in the Combo that holds the data you wish to display, Remember that the columns in a combo, or list box for that matter, are numbered from zero on up. The zero (first column) is often hidden and bound.

Alternatively you could use a List Box if you have the space on your form.
 
Apologies John, I haven't explained myself clearly enough.

My combo box has four companies details listed in it. For example
Company1, Dept1, Address1
Company2, Dept2, Address2
Company3, Dept3, Address3
Company4, Dept4, Address4.

When I go to select, say Company3, Dept3, Address3, my combo box, and the two unbound text boxes I already have (with the code you suggested) populates with the first line (Company1, Dept1, Address1). It keeps doing this regardless of which selection I make
 
I'm unsure of what you mean by the new selection? All I can get to show regardless of the selection I make is Company1 (in the combo box), Dept1 (in the first unbound text box) and Address1 (in the second text box).
 

Users who are viewing this thread

Back
Top Bottom