access query

L

Leslie

I have a query that pulls name/address information. There is an adrcode
field that shows if the address is work or home and there is a company field.
I only want to pull the company field if the adrcode field = work. How can
I do this?
 
K

KARL DEWEY

Did not follow all you said. Do you have two addresses or one that can be
either home or work?
 
M

Marshall Barton

Leslie said:
I have a query that pulls name/address information. There is an adrcode
field that shows if the address is work or home and there is a company field.
I only want to pull the company field if the adrcode field = work. How can
I do this?


Use a calculated field something like:

ContactAddr: IIf(adrcode = "work", homeaddress, workaddress)
 
K

KARL DEWEY

My best guess at what you want is that you are only interested in the company
name. So if the address is home then ignore.
In the design view of your query add an output field to the grid like this --
Company Name: IIF([adrcode] = "work", [company],"")
or
Company Name: IIF([adrcode] = "work", [company],"Home address only")
 
Top