Debra Pringle
2017-07-20 17:05:13 UTC
Hello,
I am working on a query and cannot figure out how to add the word "and" to my scenario if the [Spouse] field is not empty.
My scenario is this:
Field names are [FName], [Spouse], [LName]
Always there is a name in FName and LName but sometimes there is no spouse.
IF [Spouse] is not Null, I need my formula to add the word "and" to the final answer. IF [Spouse] is Null, then just the [FName] [LName] should show.
This is the formula I have so far:
Full Name: [FName] & " " & IIf([Spouse] Is Not Null,[Spouse]) & " " & [LName]
I got my formula to work except for adding the word "and" with the formula I shared. What do I need to add to this formula to get the word "and" IF [Spouse] is not Null
End result should be:
IIf [Spouse] is not Null then this is what the answer should be: Ed and Debbie Pringle
IIf [Spouse] is Null then this is what the answer should be: Ed Pringle
This is done in a query in Microsoft Access.
I am working on a query and cannot figure out how to add the word "and" to my scenario if the [Spouse] field is not empty.
My scenario is this:
Field names are [FName], [Spouse], [LName]
Always there is a name in FName and LName but sometimes there is no spouse.
IF [Spouse] is not Null, I need my formula to add the word "and" to the final answer. IF [Spouse] is Null, then just the [FName] [LName] should show.
This is the formula I have so far:
Full Name: [FName] & " " & IIf([Spouse] Is Not Null,[Spouse]) & " " & [LName]
I got my formula to work except for adding the word "and" with the formula I shared. What do I need to add to this formula to get the word "and" IF [Spouse] is not Null
End result should be:
IIf [Spouse] is not Null then this is what the answer should be: Ed and Debbie Pringle
IIf [Spouse] is Null then this is what the answer should be: Ed Pringle
This is done in a query in Microsoft Access.