Combo Box

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!
 
K

KARL DEWEY

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.
 
A

Amelia

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!
 
K

KARL DEWEY

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!
 
J

John W. Vinson

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.
 
A

Amelia

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
 
J

John W. Vinson

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.
 

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

Similar Threads

dependent combo boxes 1
Combo Box, Unbound Text Boxes 2
Duplicate data on combo box 7
Cascading Combo Boxes 3
Combo box help! 3
Form help 4
Combo box Question 0
Combo Box headache 9

Top