tripleblessed
Technical User
I'm pulling the correct address based on Mailing Code = "H" or "W" but I need to pull the Title and Company fields if the code = "W". How do I add this to my Select statement? Also, is there a better way to write this?
Here's what I have:
SELECT LSPAAalumni.[Salutation], LSPAAalumni.[First Name], LSPAAalumni.[Last Name], LSPAAalumni.[Suffix], IIf([LSPAAalumni]![Preferred Mailing Code]="H",[LSPAAalumni]![Home Address],[LSPAAalumni]![Work Address]) AS Address, IIf([LSPAAalumni]![Preferred Mailing Code]="H",[LSPAAalumni]![Home Address2],[LSPAAalumni]![Work Address2]) AS Address2, IIf([LSPAAalumni]![Preferred Mailing Code]="H",[LSPAAalumni]![Home City],[LSPAAalumni]![Work City]) AS City, IIf([LSPAAalumni]![Preferred Mailing Code]="H",[LSPAAalumni]![Home State],[LSPAAalumni]![Work State]) AS State, IIf([LSPAAalumni]![Preferred Mailing Code]="H",[LSPAAalumni]![Home Zip],[LSPAAalumni]![Work Zip]) AS Zip
FROM LSPAAalumni;
Here's what I have:
SELECT LSPAAalumni.[Salutation], LSPAAalumni.[First Name], LSPAAalumni.[Last Name], LSPAAalumni.[Suffix], IIf([LSPAAalumni]![Preferred Mailing Code]="H",[LSPAAalumni]![Home Address],[LSPAAalumni]![Work Address]) AS Address, IIf([LSPAAalumni]![Preferred Mailing Code]="H",[LSPAAalumni]![Home Address2],[LSPAAalumni]![Work Address2]) AS Address2, IIf([LSPAAalumni]![Preferred Mailing Code]="H",[LSPAAalumni]![Home City],[LSPAAalumni]![Work City]) AS City, IIf([LSPAAalumni]![Preferred Mailing Code]="H",[LSPAAalumni]![Home State],[LSPAAalumni]![Work State]) AS State, IIf([LSPAAalumni]![Preferred Mailing Code]="H",[LSPAAalumni]![Home Zip],[LSPAAalumni]![Work Zip]) AS Zip
FROM LSPAAalumni;