RE: IIf statements

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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

--
Wayne
Manchester, England.



"Kylie" wrote:

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
.