if you want like: ABC,n/a,CBS,n/a use:
Nz(Field1,"n/a") & ", " & Nz(Field2,"n/a") & ", " & Nz(Field3,"n/a") & ", " & Nz(Field4,"n/a")
Main Topics
Browse All Topicshi!
im trying to merge data from 20 columns into one column with "and" or a comma as a separator. unfortunately, i keep on getting the null values as well.
ex. column 1 - null
column 2 - null
column 3 - gate
merge into one column it looks like - "and and gate" or ", , gate"
how can i make access return the value only if it is not null - for twenty columns, i do not think it is practical to create if statements for all the possibilities. please help!!!!!
thanks,
ann
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
But, if you like ABC,CBS and ignoring null values, then use
Dim strTemp As String
if Nz(Field1,"") <>"" Then strTemp =strTemp &Field1 & ", "
if Nz(Field2,"") <>"" Then strTemp =strTemp &Field2 & ", "
if Nz(Field3,"") <>"" Then strTemp =strTemp &Field3 & ", "
if Nz(Field4,"") <>"" Then strTemp =strTemp &Field4 & ", "
strTemp = Left(strTemp,Len(strTemp)-
FYI: and empty field, depending in its field type could be Null or Empty. Therefore we need to use following code to handle both:
Nz(Field1,"") <>""
Now, Field1 if it is and Empty string (""), Nz() will become "" and then will be compared with <>"".
But, if it is a null value, it will change to "" thus covering both possiblities.
Therefore, first code need to be:
iif(Nz(Field1,"")="","n/a"
Also, you may consider using | (in my keyboard it is above Enter key).
mike
Business Accounts
Answer for Membership
by: ChrisFretwellPosted on 2004-11-25 at 14:28:01ID: 12677458
You will need to something on each column (except the first), but only once on each column (or write a function to do it and pass
field1 + iif(isnull(field2),""," and "+field2) + iif(isnull(field3),""," and "+field3) + ect
This will only add the 'and' or comma if the field you are adding has a value.
Chris