Use Mailing Address

S

serviceenvoy

I have a database of technician addresses. Sometimes their location
address is different from their mailing address. We check a box
labeled "use mailing address" and then we fill out their mailing
address. I have a report that prints their regular address but I
don't know how to make the report look at the alternate mailing
address when that checkbox is checked. Can anyone help me with this?
 
D

Douglas J. Steele

In the query that comprises the recordsource for the report, use something
like:

IIf([UseMailingAddress], [MailingAddress], [LocationAddress]) As Address
 
S

serviceenvoy

In the query that comprises the recordsource for the report, use something
like:

IIf([UseMailingAddress], [MailingAddress], [LocationAddress]) As Address

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)


I have a database of technician addresses. Sometimes their location
address is different from their mailing address. We check a box
labeled "use mailing address" and then we fill out their mailing
address. I have a report that prints their regular address but I
don't know how to make the report look at the alternate mailing
address when that checkbox is checked. Can anyone help me with this?

I tried to put this in the query the report is based on. I assume I
should use the same type of formula for each field like this:
IIf([UseMailingAddress], [MailingAddress], [LocationAddress]) As
Address
IIf([UseMailingCity], [MailingCity], [LocationCity]) As City
IIf([UseMailingState], [MailingState], [LocationState]) As State
etc. Is that right?
Do I put that formula in the criteria section of the query or
somewhere else?
When I put it in the criteria section I got an error on the "As
Address" section.
What do I need to do?
 
D

Douglas J. Steele

You put those formulae in empty columns on the Fields row.

However, IIf([UseMailingAddress], [MailingAddress], [LocationAddress]) As
Address is how it will appear in the SQL of the query. When you're working
with the grid, you need to put

Address: IIf([UseMailingAddress], [MailingAddress], [LocationAddress])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I tried to put this in the query the report is based on. I assume I
should use the same type of formula for each field like this:
IIf([UseMailingAddress], [MailingAddress], [LocationAddress]) As
Address
IIf([UseMailingCity], [MailingCity], [LocationCity]) As City
IIf([UseMailingState], [MailingState], [LocationState]) As State
etc. Is that right?
Do I put that formula in the criteria section of the query or
somewhere else?
When I put it in the criteria section I got an error on the "As
Address" section.
What do I need to do?
In the query that comprises the recordsource for the report, use
something
like:

IIf([UseMailingAddress], [MailingAddress], [LocationAddress]) As Address

I have a database of technician addresses. Sometimes their location
address is different from their mailing address. We check a box
labeled "use mailing address" and then we fill out their mailing
address. I have a report that prints their regular address but I
don't know how to make the report look at the alternate mailing
address when that checkbox is checked. Can anyone help me with this?
 

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