Avatar of LindaOKSTATE
LindaOKSTATE
Flag for United States of America asked on

Access concatenated string blank if any of the fields are blank

I have 3 fields, COMMENT_1, COMMENT_2 and COMMENT_3.  Almost every record has a  COMMENT_1, a few have  COMMENT_1 & COMMENT_2 and of course even less have  COMMENT_1 & COMMENT_2  & COMMENT_3.   I have concatenated them in the query as Comments: [ COMMENT_1] & " "& [ COMMENT_2]& " "& [COMMENT_3].  If all three comment fields are not blank, the concatenated string shows up in the query.  If   COMMENT_2 or COMMENT_3 are blank, none of the comments show up and the concatenated field is blank.  Can anyone see what is wrong?  I have never had this happen before.

Thanks
Linda
Microsoft Access

Avatar of undefined
Last Comment
mbizup

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
trbaze

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
mbizup

Also try this:


Comments: [ COMMENT_1] + " " + [ COMMENT_2] + " " + [COMMENT_3]
LindaOKSTATE

ASKER
I tried Comments: [ COMMENT_1] + " " + [ COMMENT_2] + " " + [COMMENT_3] .  It did what my original statement did.  If any fields were blank, it made the whole statement blank.  However, since my original statement is working now, I'm not really sure what my Access is doing.

Thank you for your suggestion.
Linda
mbizup

I'm not too surprised your original statement started working.


A null concatenated with a string will result in that string, so I don't think there was anything wrong with your syntax.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck