A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old May 6th, 2004, 08:46 PM
Stuart R
external usenet poster
 
Posts: n/a
Default Need a comma if field has data, but suppress comma if empty

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 R


  #2  
Old May 7th, 2004, 12:31 AM
Doug Robbins - Word MVP
external usenet poster
 
Posts: n/a
Default Need a comma if field has data, but suppress comma if empty

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" wrote in message
...
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 R



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.