Link to home
Start Free TrialLog in
Avatar of LindaOKSTATE
LindaOKSTATEFlag 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
ASKER CERTIFIED SOLUTION
Avatar of trbaze
trbaze

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mbizup
Also try this:


Comments: [ COMMENT_1] + " " + [ COMMENT_2] + " " + [COMMENT_3]
Avatar of 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
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.