combo box

  • Thread starter Thread starter Evelyn Ballantyne
  • Start date Start date
E

Evelyn Ballantyne

I have a form named "menu" with a textbox in
named "tbsurname" I enter a surname and can print an
envelope from a query with the criteria - [Forms]![menu]!
[tbsurname] -

I would like to change this textbox on the form to a
combo box so the names can be selected from a list. I can
do this but it does not bring the address with it??

AND if possible I would like to be able to select both
Surname and first_name from the list.

The Primary key in my table is an auto number, the
surname cannot be a primary key because there is more
than one of the same. same with first_name
 
Evelyn,

Question, Are you storing the address seperately? In a
seperate field? If so, the task is not that hard. Since
you can not create a primary key for the table from either
the first or last name or the combination of the two
because of the potential for duplicates, having an
autonumber field be your primary key is a good idea, but
you will need to use this number in your queries. Set the
where condition in your query to use the primary key in
the table and the combo box. The value in the combobox
needs to be your primary key. If you don't want that
displayed, set the column width for that column to 0". The
value displayed then would be the first value where the
column width is > 0". Queries will use the first value in
the first column regardles of its width.

I hope this is not to confusing. If so, post back and I
will try again.

Kevin
 
Thank you Kevin, I now have a three column combo box,
first primary number, second surname, third first_name.
This is great, it puts the correct address on the report
for printing. so I can now select the surname with the
correct first name. much better.

i would like the address to appear on the form when I
select the name, the form is based on the query (which
has the correct name and address in, but when i put the
address line (from the field list) on to the form nothing
appears in it. at the moment I have a button giving a
print preview of the report with the address but it would
be better to just see it appear on the form and have just
one button to print it.

I get the name and address from the table
called "Tnames_and_address" that contains all names and
addresses like this:- in the row source of the combo box
i entered "SELECT Tnames_and_address.code,
Tnames_and_address.surname, Tnames_and_address.first_name
FROM Tnames_and_address; "

AND - sorry for this seemingly simple problem but I have
sorted the Name and address table into alphabetical order
of surname but the combo box opens in number order, not
very good for the user.
evelyn
-----Original Message-----
Evelyn,

Question, Are you storing the address seperately? In a
seperate field? If so, the task is not that hard. Since
you can not create a primary key for the table from either
the first or last name or the combination of the two
because of the potential for duplicates, having an
autonumber field be your primary key is a good idea, but
you will need to use this number in your queries. Set the
where condition in your query to use the primary key in
the table and the combo box. The value in the combobox
needs to be your primary key. If you don't want that
displayed, set the column width for that column to 0". The
value displayed then would be the first value where the
column width is > 0". Queries will use the first value in
the first column regardles of its width.

I hope this is not to confusing. If so, post back and I
will try again.

Kevin
-----Original Message-----
I have a form named "menu" with a textbox in
named "tbsurname" I enter a surname and can print an
envelope from a query with the criteria - [Forms]! [menu]!
[tbsurname] -

I would like to change this textbox on the form to a
combo box so the names can be selected from a list. I can
do this but it does not bring the address with it??

AND if possible I would like to be able to select both
Surname and first_name from the list.

The Primary key in my table is an auto number, the
surname cannot be a primary key because there is more
than one of the same. same with first_name
.
.
 
Back
Top