IIf statements


K

Kylie

Hi,
I'm trying to write an IIf statement to produce mailing labels.
What I'm trying to do is:
If the teaching position is Principal then the letter is sent to the
directors address, otherwise the letter is sent to the Principal at the
school but this needs to be the school mailing address (or if that is null)
the school address.

This is what I have so far: (this part is just to print the correct mailing
address)
Letter Address: IIf([NSW Applications]![TEACHPOS]="PRIN",[Supt
Listing]![ADDRESS] & "
" & [CITY] & " NSW " & [POSTCODE],IIf(IsNULL[NSW Applications]![MSCHLADD],
[SCHLADD] & "
" & [SCHLCITY] & " NSW " & [SCHLPCODE],[MSCHLADD] & "
" & [MSCHLCITY] & " " & [MSCHLSTATE] & " " & [MSCHLPCODE]))

Any advice would be greatly appreciated
 
Ad

Advertisements

W

Wayne-I-M

Hi Kylie


Create a query and ensure that you have the following fields in
[TEACHPOS]
[PRINCIPLENAME]
[DIRECTORSADDRESS]
[CITY]
[POSTCODE]
[MSCHLADD]
[SCHLADD]
[SCHLCITY]
[SCHLPCODE]
[MSCHLADD]
[MSCHLCITY]
[MSCHLSTATE]
[MSCHLPCODE]


In the report or mailing lable use this as the source for a text box

IIf ([TEACHPOS]="PRIN", [PRINCIPLENAME] & Chr(13)+Chr(10)+[DIRECTORSADDRESS]
& Chr(13)+Chr(10)+[CITY] & Chr(13)+Chr(10)+"NSW"& Chr(13)+Chr(10)+[POSTCODE],
IIf ( IsNull ([MSCHLADD ]) , [PRINCIPLENAME] & Chr(13)+Chr(10)+[SCHLADD] &
Chr(13)+Chr(10)+[SCHLCITY] & Chr(13)+Chr(10)+"NSW"&
Chr(13)+Chr(10)+[SCHLPCODE], [PRINCIPLENAME] & Chr(13)+Chr(10)+[MSCHLADD] &
Chr(13)+Chr(10)+[MSCHLCITY] & Chr(13)+Chr(10)+[MSCHLSTATE] &
Chr(13)+Chr(10)+[MSCHLPCODE]) )


If you get any errors – 1st check the spelling of the field names – 2nd step
through this formula as it too early in the morning for my head to cope with
such things

Good luck
 
J

Jeff Boyce

What happens when you use this expression?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Ad

Advertisements

K

Kylie

It says I have an operand with out an operator. Just fixed it though but
re-doing it again in the builder. Works now. Thanks for the help anyway

Jeff Boyce said:
What happens when you use this expression?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Kylie said:
Hi,
I'm trying to write an IIf statement to produce mailing labels.
What I'm trying to do is:
If the teaching position is Principal then the letter is sent to the
directors address, otherwise the letter is sent to the Principal at the
school but this needs to be the school mailing address (or if that is
null)
the school address.

This is what I have so far: (this part is just to print the correct
mailing
address)
Letter Address: IIf([NSW Applications]![TEACHPOS]="PRIN",[Supt
Listing]![ADDRESS] & "
" & [CITY] & " NSW " & [POSTCODE],IIf(IsNULL[NSW
Applications]![MSCHLADD],
[SCHLADD] & "
" & [SCHLCITY] & " NSW " & [SCHLPCODE],[MSCHLADD] & "
" & [MSCHLCITY] & " " & [MSCHLSTATE] & " " & [MSCHLPCODE]))

Any advice would be greatly appreciated
 

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

IIf statement 3
IIF statement?? 2
IIf statement 6
iif statement 4
IIF Statement 2
Help with IIf statement 2
conditional iif statement 5
iif statements for a beginner 3

Top