Mail merge into columns with variable length data?

N

Nigel Molesworth

I want to merge some data into a document with 3 columns (see my filoFax
question earlier today). Unlike labels, the data is variable length, so I
need to find a way of flowing the text with a blank line, see below:

Adams: Brian Arkwright: Paul Blackstone: Tom
Tel: 01234 45679 Tel: 01234 45679 Mob: 07770 12345
Mob: 07770 12345
Fax: 01234 15643 Austin: Mini
Tel: 01234 45679
Alundu: Josh Mob: 07770 12344
Tel: 01234 45676
Mob: 07770 12346 Bateman: David
Mob: 07770 12344

.... ... ...


I also want to suppress lines with no data, and insert the Tel: or Mob: etc
on lines which have data.

Any ideas?
 
D

Doug Robbins - Word MVP

Use a Directory, (or Catalog in versions before Word XP) type mail merge
main document with a one row three column table in it and insert the
mergefields into the cells of that table.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
N

Nigel Molesworth

Use a Directory, (or Catalog in versions before Word XP) type mail merge
main document with a one row three column table in it and insert the
mergefields into the cells of that table.

OK, I'm getting somewhere - I think.

The following adds the text "Tel:" and the phone number for records with a
phone number, but I can only check this by manually going to the next record
in the Preview group on the ribbon. Despite the <<Next Record>> it will only
insert a single entry, not the whole database.

<<Surname>>: <<HisName>> [CR]
{IF {MERGEFIELD TEL}<>"" "Tel:" ""}<<Tel>> [CR]
<<Next Record>>
 
D

Doug Robbins - Word MVP

Sounds like you are trying to perform a "multiple items per condition (=key
field)" mailmerge which Word does not really have the ability to do:

See the "Group Multiple items for a single condition" item on fellow MVP
Cindy Meister's website at

http://homepage.swissonline.ch/cindymeister/mergfaq1.htm#DBPic


Or take a look at the following Knowledge Base Article

http://support.microsoft.com/default.aspx?scid=kb;en-us;211303

or at:

http://cornell.veplan.net/article.aspx?&a=3815


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Nigel Molesworth said:
Use a Directory, (or Catalog in versions before Word XP) type mail merge
main document with a one row three column table in it and insert the
mergefields into the cells of that table.

OK, I'm getting somewhere - I think.

The following adds the text "Tel:" and the phone number for records with a
phone number, but I can only check this by manually going to the next
record
in the Preview group on the ribbon. Despite the <<Next Record>> it will
only
insert a single entry, not the whole database.

<<Surname>>: <<HisName>> [CR]
{IF {MERGEFIELD TEL}<>"" "Tel:" ""}<<Tel>> [CR]
<<Next Record>>
 
N

Nigel Molesworth

Sounds like you are trying to perform a "multiple items per condition (=key
field)" mailmerge which Word does not really have the ability to do:

Not really, I'm just limiting the output to the non-bland fields. I think
that aspect may be sorted, so I'll ignore it for now.

My main problem is getting more than one *record* to be processed. If I was
doing labels, it's easy: I'd just put the following in each table cell:

<<Surname>>: <<HisName>> [CR]
<<Tel>> [CR]
<<Next Record>>

But here the problem if different. I don't know how many records I will have
in a given column (or on a given page) because the data in the records is
not all the same length (e.g. some don't have cell phone numbers).

It is, as you say, a directory. I'm trying to replicate the phone book!
 
D

Doug Robbins - Word MVP

You need to use an If...Then...Else field construction so that your set up
in the catalog or directory mail merge main document looks like

{ MERGEFIELD Surname } { MERGEFIELD HisName } [CR]
{ IF { MERGEFIELD Cell } <> "" "{ MERGEFIELD Tel } [CR]
{ MERGEFIELD Cell }" "{ MERGEFIELD Tel }" }

and so on for you other fields that may or may not contain data. You do not
need a <<Next Record>> field.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Nigel Molesworth said:
Sounds like you are trying to perform a "multiple items per condition
(=key
field)" mailmerge which Word does not really have the ability to do:

Not really, I'm just limiting the output to the non-bland fields. I think
that aspect may be sorted, so I'll ignore it for now.

My main problem is getting more than one *record* to be processed. If I
was
doing labels, it's easy: I'd just put the following in each table cell:

<<Surname>>: <<HisName>> [CR]
<<Tel>> [CR]
<<Next Record>>

But here the problem if different. I don't know how many records I will
have
in a given column (or on a given page) because the data in the records is
not all the same length (e.g. some don't have cell phone numbers).

It is, as you say, a directory. I'm trying to replicate the phone book!
 
N

Nigel Molesworth

You do not need a <<Next Record>> field.

Now I'm confused! I think I may have overcomplicated my question.

Can we skip the issue of possibly blank fields, and discuss how to do a mail
merge into a (3 column) page with the following data, each record to go on a
new line (inserted by the merge master document).


Record 1 | Field 1: "A short bit of text"

Record 2 | Field 1: "This is a long bit of text - Lorem ipsum dolor sit
amet, consectetuer adipiscing elit. Cras ultricies sem et nisl. Pellentesque
in erat at justo venenatis convallis. Phasellus imperdiet, risus id vehicula
commodo, nulla leo cursus nisi, eu congue diam lorem a purus."

Record 3 | Field 1: "Another short bit of text"

Record 4 | Field 1: etc ....


With data of a fixed maximum length, fitting into cells in a table (for
example to create labels) there is no problem. You just have <<Next Record>>
in each cell. There are a fixed number of records per page, for example 14,
18, or 21, corresponding to the labels.

The problem I'm trying to solve is that the data I'm using is not going into
fixed cells, so I don't know how to "get" the next record, and I don't know
how many records there are per page or per column.
 
S

Suzanne S. Barnhill

It sounds to me as if you need to do a Catalog/Directory-type merge into a
multi-column page. No «Next Record» field is required in this type of merge;
Word gets it automatically.
 
N

Nigel Molesworth

It sounds to me as if you need to do a Catalog/Directory-type merge into a
multi-column page.

I'm using a table to give me control of the exact size, should this work?
No «Next Record» field is required in this type of merge;
Word gets it automatically.

OK, I've just done a test. My only text in the merge document is:

<<Surname>> [^l]
<<Tel>> [^p]

Is this what you mean? Because this code only inserts the first record in
the database, although I can scroll through them all with the Next Record in
the Preview group on the ribbon (so the source is OK).
 
S

Suzanne S. Barnhill

I believe you need to have an empty paragraph after the paragraph you
entered.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Nigel Molesworth said:
It sounds to me as if you need to do a Catalog/Directory-type merge into a
multi-column page.

I'm using a table to give me control of the exact size, should this work?
No «Next Record» field is required in this type of merge;
Word gets it automatically.

OK, I've just done a test. My only text in the merge document is:

<<Surname>> [^l]
<<Tel>> [^p]

Is this what you mean? Because this code only inserts the first record in
the database, although I can scroll through them all with the Next Record
in
the Preview group on the ribbon (so the source is OK).
 
Top