June 10, 2024
Access Forum Top Contributors:
Access reports- combining first & last names
Report abuse
Thank you.
Reported content has been submitted
IIf(IsNull([SpouseName]);[FirstName] & " " & [Lastname];[FirstName] & " & " & [SpouseName] & " " & [LastName])
Peter (http://access.xps350.com/)
Peter
Report abuse
Thank you.
Reported content has been submitted
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
You've got more problems than that. It's the 21st century... my name is John Vinson, my wife's name is Karen Strickler! She'll be justly piqued if you use your logic.
That said, Peter's IIF will work fine (for the question as stated); you can also use a sneaky feature. The & and + operators both concatenate strings, but & treats a NULL field as a zero length string, while + treats it as a NULL, returning NULL as a result of the concatenation. So you could use
[FirstName] & (" & " + [SpouseName]) & " " & [LastName]
The expression in parentheses will evaluate to NULL if the SpouseName is null.
John W. Vinson/MVP
Report abuse
Thank you.
Reported content has been submitted
2 people found this reply helpful
·Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Question Info
Last updated October 9, 2021 Views 1,576 Applies to: