ghettocounselor
asked on
isnull inside of an iff statement MS Access
I'm having some trouble working out using the isnull within an if statement (MS Access 2003).
Things looks roughly like this -
MEDMRKUP - MEDMIN - IVMRKUP - IVMIN: IIf([GEN_DISP_UNIT]="DPU", [MED_PVAR1 _DPU],[MED _PVAR1_DPD ])+".....
the [MED_PVAR1_DPU] and [MED_PVAR1_DPD] might be null.
Things looks roughly like this -
MEDMRKUP - MEDMIN - IVMRKUP - IVMIN: IIf([GEN_DISP_UNIT]="DPU",
the [MED_PVAR1_DPU] and [MED_PVAR1_DPD] might be null.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
= UCase([LastName]) & ', ' & [FirstName] & ' ' & [Initial] & '. (' & [Title] & ')'
That looks like a ControlSource for a textbox on a form.
That's a place where @Harfang's nice little trick will work
= UCase([LastName]) & ', ' & [FirstName] + ' ' & [Initial] & '. ' + (' & [Title] & ')'
As a ControlSource for a textbox, this will collapse to "DOE, John" when the initial and title are null
MEDMRKUP - MEDMIN - IVMRKUP - IVMIN: IIf([GEN_DISP_UNIT]="DPU", Nz([MED_PV AR1_DPU],' ndpu'),Nz( [MED_PVAR1 _DPD],'ndp d'))+" ....
This looks like it's from a query, and that's pretty much the only way to do it.
That looks like a ControlSource for a textbox on a form.
That's a place where @Harfang's nice little trick will work
= UCase([LastName]) & ', ' & [FirstName] + ' ' & [Initial] & '. ' + (' & [Title] & ')'
As a ControlSource for a textbox, this will collapse to "DOE, John" when the initial and title are null
MEDMRKUP - MEDMIN - IVMRKUP - IVMIN: IIf([GEN_DISP_UNIT]="DPU",
This looks like it's from a query, and that's pretty much the only way to do it.
ASKER
= UCase([LastName]) & ', ' & [FirstName] & ' ' & [Initial] & '. (' & [Title] & ')'
This shows as "DOE, John A. (Dr)". This is nice unless there is no middle initial or no title: "DOE, John . ()". If needed, Null values can be converted using Nz(). For example, display "nmi" for "no middle initial" or "?" for missing title:
... & Nz([Initial], 'nmi')
from link in selected resolution.
seems to be working as expected:
MEDMRKUP - MEDMIN - IVMRKUP - IVMIN: IIf([GEN_DISP_UNIT]="DPU",