Combo Box

  • Thread starter Thread starter Amelia
  • Start date Start date
A

Amelia

I have a combo box named "customer"
I have it set up to pull information from a contact list query.
Once I click on the contact, I want all of their information to go into the
box so when I go to a report it prints out. (I am creating an invoice)
But, when I click on the customer name, it only returns the first name.
How do I get it to return [first name] [last name] [company] [title]
[address] [city] [state] [zipcode]?

Also I would like it to come back in this format:
[first name] [last name]
[company name] [title]
[address]
[city] [state] [zipcode]

Can anyone assist? And tell me in layman terms? I am still learning access!
Thanks!
 
Assuming you are using an autonumber as primary key make your query like this
--
SELECT [PrimaryKey], [first name] &" "& [last name]& Chr(13)& Chr(10) &
[company name]&" "& [title]& Chr(13)& Chr(10) &
[address]& Chr(13)& Chr(10) &
[city]&" "& [state]&" "& [zipcode]
FROM [YourTable];

You will need to resize the combo box Height and Width to accommodate the 4
lines.
 
Where do I put this code? in the query? in SQL view? Or somewhere in the form
properties? (I am using Access 2007)

KARL DEWEY said:
Assuming you are using an autonumber as primary key make your query like this
--
SELECT [PrimaryKey], [first name] &" "& [last name]& Chr(13)& Chr(10) &
[company name]&" "& [title]& Chr(13)& Chr(10) &
[address]& Chr(13)& Chr(10) &
[city]&" "& [state]&" "& [zipcode]
FROM [YourTable];

You will need to resize the combo box Height and Width to accommodate the 4
lines.

Amelia said:
I have a combo box named "customer"
I have it set up to pull information from a contact list query.
Once I click on the contact, I want all of their information to go into the
box so when I go to a report it prints out. (I am creating an invoice)
But, when I click on the customer name, it only returns the first name.
How do I get it to return [first name] [last name] [company] [title]
[address] [city] [state] [zipcode]?

Also I would like it to come back in this format:
[first name] [last name]
[company name] [title]
[address]
[city] [state] [zipcode]

Can anyone assist? And tell me in layman terms? I am still learning access!
Thanks!
 
In SQL view.

Amelia said:
Where do I put this code? in the query? in SQL view? Or somewhere in the form
properties? (I am using Access 2007)

KARL DEWEY said:
Assuming you are using an autonumber as primary key make your query like this
--
SELECT [PrimaryKey], [first name] &" "& [last name]& Chr(13)& Chr(10) &
[company name]&" "& [title]& Chr(13)& Chr(10) &
[address]& Chr(13)& Chr(10) &
[city]&" "& [state]&" "& [zipcode]
FROM [YourTable];

You will need to resize the combo box Height and Width to accommodate the 4
lines.

Amelia said:
I have a combo box named "customer"
I have it set up to pull information from a contact list query.
Once I click on the contact, I want all of their information to go into the
box so when I go to a report it prints out. (I am creating an invoice)
But, when I click on the customer name, it only returns the first name.
How do I get it to return [first name] [last name] [company] [title]
[address] [city] [state] [zipcode]?

Also I would like it to come back in this format:
[first name] [last name]
[company name] [title]
[address]
[city] [state] [zipcode]

Can anyone assist? And tell me in layman terms? I am still learning access!
Thanks!
 
I have a combo box named "customer"
I have it set up to pull information from a contact list query.
Once I click on the contact, I want all of their information to go into the
box so when I go to a report it prints out. (I am creating an invoice)

The combo box should return the customer ID (which is unique) rather than
first name - you could very well have many customers with the same first name!

Rather than including all of the contact information *in the combo box*, base
your Form on a Query including the contact list table, and use the combo box
(with its unique ID) as a criterion in the query.
 
So if I get the combo box to return the PID (Person ID), how do I get the
report to print out the actual name, address, city, state, MN

Amy
 
So if I get the combo box to return the PID (Person ID), how do I get the
report to print out the actual name, address, city, state, MN

Base the Report on a query joining your table to the Persons table by PID.
Include controls on the report bound to the name, address, etc. fields from
the Persons table. Use a criterion on the query

=Forms!yourformname!comboboxname

to select the correct PID.
 
Back
Top