Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / January 2006

Tip: Looking for answers? Try searching our database.

Multiple IIF in Query for Report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TinleyParkILGal - 16 Jan 2006 18:00 GMT
Dear Professionals:

In my table my fields are:

Salutation
FirstName
Middle Name
Last Name

In my report I have one field in which I want to concatenate the full name.
I only need to list salutation if the saluation is Dr. and in some cases I
have a middle initial or name and in some I do not.

Here is my current IIF statement for the field in my report:
=IIf([Salutation]="Dr.",[Salutation] & " " & [FirstName] & " " &
[LastName],[FirstName] & " " & [LastName])

I have totally excluded MiddleName from the statement because I could not
figure out how to account for each of the situations below and keep the
spacing correct:

Dr. with first, middle, last
Dr. with first, last name
No Dr. with first, last, middle
No Dr. with first, last

Thank you in advance.
Ofer - 16 Jan 2006 18:25 GMT
I'm not sure if that what you are looking for

=IIf([Salutation]="Dr.",[Salutation] & " " & [FirstName] & " " & ([Middle
Name] + " ") & [LastName],[FirstName] & " " & ([LastName] + " ") & [Middle
Name])

Signature

\\// Live Long and Prosper \\//
BS"D

> Dear Professionals:
>
[quoted text clipped - 23 lines]
>
> Thank you in advance.
John Spencer - 16 Jan 2006 21:06 GMT
= IIF(Salutation="Dr.","Dr. ") & [First Name] & (" " + [Middle Name]) & (" " +
[Last Name])

This takes into account the different ways that & or + work when adding together strings.

If a value is null, then the + will add that null to the string and give you
NULL.  So " " + Middle Name will end up being blank, while " " & Middle Name
will end up being one space long.

> Dear Professionals:
>
[quoted text clipped - 23 lines]
>
> Thank you in advance.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.