I have a requirement to insert mergefields in a "form" that can have from 1
to about 100 rows. I created a table with 100 mergefields, but if the
mergefields from, lets say, 10-100 are blank, then 1-9 look fine, but 10-
100 are blank, and don't roll up.
I got around this by making my table only 2 rows deep, with the first row
having the "labels" and using IF...THEN...ELSE for all the 100 mergefields.
I insert two blank lines if the mergefield is not null, so a blank line
separates the non-blank entries, and all the blanks roll up.
While that looks ok, it does not look as good as a fully formed table in
the merge doc. It also means I can not merge other data on the same row
without potential problems with blank entries for the second field, and
possible wraping of data in a cell - which would look terrible in a two row
table.
So I wondered if there was any way to delete the unused rows in the table
in the merge doc if there was no data in any cell on the row.
Thanks
Peter Jamieson - 05 Apr 2005 08:58 GMT
I don't think you will be able to do this using fields for the reasons you
have already discovered.
I think your options include:
a. do the merge and postprocess the output to remove blank table rows. You
could probably do that with a relatively simple bit of VBA. However, if you
have to output directly to printer, e-mail or fax, it isn't an option.
b. use the "mailmerge events" I suggested. That also requires VBA and I can
tell you that it's likely to be a lot harder to get right than (a).
c. "roll your own" merge using (say) VBA. That's more work than either (a)
or (b) but in principle gives you a lot more control.
d. redesign your data source so that a field-based solution (or some other
solution) becomes feasible. In this case, it would need to be the kind of
solution where you have 100 rows per form, each one containing a single
field, rather than 100 fields per form, all in one row. One possible
approach is to have
- a merge data source that contained one record for each "form"
- a second data file of some kind that has as many rows as are required to
generate the table for that form.
- use a DATABASE field in your mail merge main document to get the data
from the second file.
It's difficult to tell which of these approaches, if any, would help you.
Personally I would prefer it if the "FIELD language" was more powerful and
let you do this kind of stuff more easily without having to resort to
procedural code, but it isn't.
Peter Jamieson
>I have a requirement to insert mergefields in a "form" that can have from 1
> to about 100 rows. I created a table with 100 mergefields, but if the
[quoted text clipped - 15 lines]
>
> Thanks