Unique value for each record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a combo box in a form attached to a table of customers. In the
TblCustomerList, the ID# has a primary key. When listing names in the
TblCustomerList, there are several customers with the same name, but in
different cities, but they each have a separate ID number.
However, when I choose a name from the drop down list on the form, if there
is a customer with the same name, it returns to the first name listed.

What am I not doing right?
 
Add a column to the row source of the combob box that is the ID#. You can
make the Column Width property 0 so the user does not see it.
 
I already have a column for the ID number that does not show.
I would have to write for example if the company name is Pepsi -next
column-Montreal and then the next record is Pepsi-next column-Quebec, if I
select the 2nd item, it goes back to the first one. I would have to name it
Pepsi2. There must be a way that it has its own identity.
 
The unique column needs to be the bound column (combo box properties).
Your question is a little unclear, but I guess you are using an unbound
combo box to select a record. Try using the combo box wizard to set up the
combo box. You will be using the option about selecting a record based on
the combo box selection.
 
The combo box is bound to a table.
Ok I will start over - maybe my question is unclear.

I have a table for customers.
Some customers have the same name but in a different location, so they are
each entered as a separate customer. Each one has an ID number.[Site#].

I created a form where one of the fields is the customer name. This is a
combo drop down box which is bound to the table, with the Row Source saying:
SELECT [TblCustomerList].[Customer Name], [TblCustomerList].[Division],
[TblCustomerList].[City], [TblCustomerList].[Site #] FROM TblCustomerList;

When I click on the combo box I can choose the correct customer, but what is
happening is that if the name of the customer is listed more than once, it
does not keep the one I selected. It just goes back to the first name listed
that is the same.

In the table, I selected the [Site #] ID field (which has the primary key)
and set the index property to "unique".

Please help.
 
You need a unique identifier in the combo box row source. It can be a
separate field such as CustomerID (or whatever you are using as the PK in
tblCustomerList), or it can be something like a combination of Name and
Division, if you like compound keys.

Diane said:
The combo box is bound to a table.
Ok I will start over - maybe my question is unclear.

I have a table for customers.
Some customers have the same name but in a different location, so they are
each entered as a separate customer. Each one has an ID number.[Site#].

I created a form where one of the fields is the customer name. This is a
combo drop down box which is bound to the table, with the Row Source
saying:
SELECT [TblCustomerList].[Customer Name], [TblCustomerList].[Division],
[TblCustomerList].[City], [TblCustomerList].[Site #] FROM TblCustomerList;

When I click on the combo box I can choose the correct customer, but what
is
happening is that if the name of the customer is listed more than once, it
does not keep the one I selected. It just goes back to the first name
listed
that is the same.

In the table, I selected the [Site #] ID field (which has the primary key)
and set the index property to "unique".

Please help.

BruceM said:
The unique column needs to be the bound column (combo box properties).
Your question is a little unclear, but I guess you are using an unbound
combo box to select a record. Try using the combo box wizard to set up
the
combo box. You will be using the option about selecting a record based
on
the combo box selection.
 
Back
Top