Need a comma if field has data, but suppress comma if empty

S

Stuart R

Hi there

I'm putting together a mailmerge master doc (a letter to employees) in which there is a place for a list of dates, each of which is drawn from a different field in the corresponding data document. The fields are DATE1, DATE2, DATE3, and DATE4. The problem is that some of the letters need to print all four fields (i.e. that employee has four dates, and all four fields have contents in the data document) while others don't have four dates (some as few as one, in which case only the DATE1 field has anything in it, etc.). Right now I've created ther list in master document by inserting each field in turn and separating them with commas: {DATE1}, {DATE2}, {DATE3}, {DATE4}. But, when I merge the document, a person with, say, two dates only, prints out a line that looks like this: 2/12/04, 3/15/04,,

What I need is a way for it print out only the fields as there are dates in, and separate those with commas, otherwise do nothing (and leave out the unneeded commas).

I'm sure the solution is pretty straightforward, but so far I haven't been to figure out what it is! Any assistance you could provide would be much appreciated

- Stuart
 
D

Doug Robbins - Word MVP

Hi Stuart,

Use a series of If..Then..Else fields to check that there is a value in
DATE2, DATE3 and DATE4. If the condition is true, have it insert a ,
followed by the date field.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
Stuart R said:
Hi there -

I'm putting together a mailmerge master doc (a letter to employees) in
which there is a place for a list of dates, each of which is drawn from a
different field in the corresponding data document. The fields are DATE1,
DATE2, DATE3, and DATE4. The problem is that some of the letters need to
print all four fields (i.e. that employee has four dates, and all four
fields have contents in the data document) while others don't have four
dates (some as few as one, in which case only the DATE1 field has anything
in it, etc.). Right now I've created ther list in master document by
inserting each field in turn and separating them with commas: {DATE1},
{DATE2}, {DATE3}, {DATE4}. But, when I merge the document, a person with,
say, two dates only, prints out a line that looks like this: 2/12/04,
3/15/04,,,
What I need is a way for it print out only the fields as there are dates
in, and separate those with commas, otherwise do nothing (and leave out the
unneeded commas).
I'm sure the solution is pretty straightforward, but so far I haven't been
to figure out what it is! Any assistance you could provide would be much
appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top