combo box/forms question

G

Guest

i have a form with client information listed in it. to find each individual
client i am using a combo box, however, some clients have the same last name.

my problem is i can view all the different names in the combo box but am
unable to access one out of two clients with the same last name.

ie: client one - smith, anna
client two - smith, brenda

if i click on either name only anna's file will pull up.

ideas anyone.
 
A

Allen Browne

Your Client table needs a primary key. If you don't already have an
AutoNumber field named (say) ClientID. You will then be able to uniquely
refer to each client.

The RowSource for your combo will then be a query that includes the ClientID
in the first column, and the client names in subsequent columns. The query
will end up something like this:
SELECT [ClientID], [Surname] & ", " + [Firstname] AS ClientName FROM Client
ORDER BY [Surname], [Firstname];

Then set these properties for your combo:
Bound Column 1
Column Count 2
Column Widths 0
 
G

Guest

thanks for ur response..i already have a clientid field labled as the primary
key, however, i added the clientid field to my query and now none of the
records change when i select the name...HELP!

Allen Browne said:
Your Client table needs a primary key. If you don't already have an
AutoNumber field named (say) ClientID. You will then be able to uniquely
refer to each client.

The RowSource for your combo will then be a query that includes the ClientID
in the first column, and the client names in subsequent columns. The query
will end up something like this:
SELECT [ClientID], [Surname] & ", " + [Firstname] AS ClientName FROM Client
ORDER BY [Surname], [Firstname];

Then set these properties for your combo:
Bound Column 1
Column Count 2
Column Widths 0

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

MARTIN95 said:
i have a form with client information listed in it. to find each
individual
client i am using a combo box, however, some clients have the same last
name.

my problem is i can view all the different names in the combo box but am
unable to access one out of two clients with the same last name.

ie: client one - smith, anna
client two - smith, brenda

if i click on either name only anna's file will pull up.

ideas anyone.
 
A

Allen Browne

Did you also adjust the properties of the combo, so that is relies on the
ClientID and not the client name?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

MARTIN95 said:
thanks for ur response..i already have a clientid field labled as the
primary
key, however, i added the clientid field to my query and now none of the
records change when i select the name...HELP!

Allen Browne said:
Your Client table needs a primary key. If you don't already have an
AutoNumber field named (say) ClientID. You will then be able to uniquely
refer to each client.

The RowSource for your combo will then be a query that includes the
ClientID
in the first column, and the client names in subsequent columns. The
query
will end up something like this:
SELECT [ClientID], [Surname] & ", " + [Firstname] AS ClientName FROM
Client
ORDER BY [Surname], [Firstname];

Then set these properties for your combo:
Bound Column 1
Column Count 2
Column Widths 0


MARTIN95 said:
i have a form with client information listed in it. to find each
individual
client i am using a combo box, however, some clients have the same last
name.

my problem is i can view all the different names in the combo box but
am
unable to access one out of two clients with the same last name.

ie: client one - smith, anna
client two - smith, brenda

if i click on either name only anna's file will pull up.

ideas anyone.
 
G

Guest

i figured it out...i did what you had told me to but i didn't realize that
the event didn't change too.

i clicked on the "event proceedure" in the combo box properties and found
the it was looking at the lastname first. i altered the code to look at the
clientid and everything seems ok now.

thanks for all your help..

Allen Browne said:
Did you also adjust the properties of the combo, so that is relies on the
ClientID and not the client name?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

MARTIN95 said:
thanks for ur response..i already have a clientid field labled as the
primary
key, however, i added the clientid field to my query and now none of the
records change when i select the name...HELP!

Allen Browne said:
Your Client table needs a primary key. If you don't already have an
AutoNumber field named (say) ClientID. You will then be able to uniquely
refer to each client.

The RowSource for your combo will then be a query that includes the
ClientID
in the first column, and the client names in subsequent columns. The
query
will end up something like this:
SELECT [ClientID], [Surname] & ", " + [Firstname] AS ClientName FROM
Client
ORDER BY [Surname], [Firstname];

Then set these properties for your combo:
Bound Column 1
Column Count 2
Column Widths 0


i have a form with client information listed in it. to find each
individual
client i am using a combo box, however, some clients have the same last
name.

my problem is i can view all the different names in the combo box but
am
unable to access one out of two clients with the same last name.

ie: client one - smith, anna
client two - smith, brenda

if i click on either name only anna's file will pull up.

ideas anyone.
 

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