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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|