Combo box display

M

montbrae

I have a combo box that is populated with 3 fields from a query. The fields
are locality, state and postcode. The combo box shows all 3 fields sorted
by locality and state.

When clicking on the required locality, state and post code three text
fields are populated using cboName.column(0) for locality etc.

If there are two or more localities with the same locality name but
different state and post code the system only returns the first locality
regardless of which element is clicked. Any ideas?

Regards
Grant Meyers
 
R

Rick Brandt

montbrae said:
I have a combo box that is populated with 3 fields from a query. The
fields are locality, state and postcode. The combo box shows all 3
fields sorted by locality and state.

When clicking on the required locality, state and post code three text
fields are populated using cboName.column(0) for locality etc.

If there are two or more localities with the same locality name but
different state and post code the system only returns the first
locality regardless of which element is clicked. Any ideas?

Regards
Grant Meyers

The ComboBox has a property called BoundColumn. That has to be set to a column
that is unique in the list or what you are seeing will happen. Does the table
that you are pulling these values from have a Primary Key? That should be what
is in the bound column.
 
G

Guest

By populating the three text fields your table is not normalized, I'm afraid,
and consequently at risk of update anomalies You should only have a
LocalityID foreign key in the table referencing a unique (generally numeric)
primary key of a Localities table. A combo box should be bound to this
column, but show the locality name by hiding the first bound column. The
values for state and postcode should then be shown in unbound controls on the
form which reference the Column property of the combo box in their
ControlSources.
 

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