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  

Multiple records mail merge - Another Question



 
 
Thread Tools Display Modes
  #11  
Old April 4th, 2009, 12:36 AM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP on news.microsoft.com
external usenet poster
 
Posts: 409
Default Multiple records mail merge - Another Question

You need to set up your data source as indicated in the following section of
the help file:

Quote

Your data source includes a field to mark the last record of each postal
code, and the data source is sorted so that all records with the same postal
code appear together. When your data source is set up this way, you can use
SET and IF fields in Word to check whether a record is the last occurrence
of a postal code in the data source.

With this checking in place, you can use the NEXTIF field to determine
whether the current record is the last occurrence of a particular postal
code. As long as the current record is not the last occurrence, records for
that postal code are added to the current merge document. When the current
record is the last occurrence of the postal code, a new merge document is
begun for the next postal code that is listed in the data source.

When you insert the following NEXTIF field into a mail merge main document
(main document: In a mail-merge operation in Word, the document that
contains the text and graphics that are the same for each version of the
merged document, for example, the return address or salutation in a form
letter.), the NEXTIF field examines the contents of the LastZipcode field in
the current data record. If the LastZipcode field is blank, data from the
next record in the data source is merged into the current merge document. If
the LastZipcode field is not blank, data from the next record in the data
source is merged into a new merge document.

Unquote

That is, in addition to a field containing the postalcodes, you have
another field into which a marker is inserted only where the record is the
last in the series that has the same postal code. That is something that
would have to be either setup manually or you could use a macro to
pre-process the data source by sorting the records on the postal code field
and then iterate through the records to determine when the postal code
changes and then inserting the marker into the appropriate record in the
LastZipcode 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, originally posted via msnews.microsoft.com

"Captain" wrote in message
...
I was thinking I could use a NEXTIF field to do this. Word 2007 help lists
the following under NEXTIF:

"The NEXTIF field compares two expressions. If the comparison is true,
Microsoft Office Word merges the next data record (data record: A complete
set of related information that corresponds to one row of information in
the
data source. All information about one client in a client mailing list is
an
example of a data record.) into the current merge document. If the
comparison
is false, Word merges the next data record into a new merge document.

You can use the NEXTIF field to group data records, as in a database
report.
For example, you can use a combination of IF, SET, and NEXTIF fields to
merge
all records with the same postal code to one page in the merge and create
a
new page in the merge when a new postal code is encountered in the data
file.
However, a merge like this is complex to set up and requires that your
data
source be structured to accommodate the merge fields."

It does say it's "complex", but is it possible?

Thanks.

"macropod" wrote:

Hi Captain,

I'm sorry to say that E-mail Merges can't be used to group data the way
you can with Directory Merges. Unless you want to use vba to
code your own grouping & dispatch email merge process, I'm afraid you're
stuck with either/or. You may, of course, be able to find
some suitable vba code on the web.

--
Cheers
macropod
[MVP - Microsoft Word]


"Captain" wrote in message
...
This is very helpful. I was wondering if you have similar information
on
E-mail Merges instead of Directory Merges? I got your recommendations
to
work using Directory, but I would like to send emails with multiple
rows of
data. Thanks!

"macropod" wrote:

Hi mom2dramaqeen,

No need to get snippy
No need to be a drama queen either!

The 'key' field to which the tutorial field refers is whatever field
in your mailmerge data source you choose to nominate as the
one
to which changes in data groupings are 'keyed'. The tutorial says as
much.
QUOTE:
The 'Key' Field
Before using this type of mailmerge, you'll need to determine which of
the data fields you want to use as the one to trigger the
separation of the lists. This is your 'key' field. You should then
sort your data file so that all the records with the same 'key'
field value are grouped together. The accompanying Excel data file is
sorted by the 'State' field, then the 'City' field and,
finally, the 'Representative' field.

If you view the field code for the first example in the tutorial,
you'll see:
{QUOTE{IF{MERGESEQ}= 1 {SET Key ""}}"{IF{MERGEFIELD City} {Key}
"{IF{MERGESEQ} 1 "
"}{MERGEFIELD State} {MERGEFIELD City}{SET Key {MERGEFIELD City}}

" } {MERGEFIELD Representative} {MERGEFIELD Sales}
"}
In this field construction, the 'City' data field is used as the
'Key', and the the State & City names are only output when the
City
name changes.

--
Cheers
macropod
[MVP - Microsoft Word]


"mom2dramaqeen" wrote in
message
...
No need to get snippy, the articles talk about a "key" field and
since I have
no clue at all about what the article is talking about. I
understand how to
show toggle field, I know how to do that, but I cannot get it to
work and I
don't understand what you mean. I need more basic information then
what that
article says.

Sorry, I just don't get the article you keep posting and need more
indepth
info.



"Doug Robbins - Word MVP on news.microsof" wrote:

Have you followed this part of Macropods instructions:

To view the fields in this document, I recommended (sic) that you
toggle
field shading on. You can do this via Tools|Options|View and, under
'Show',
selecting the 'Always' or 'When selected' options. You'll probably
find the
'Always' option works best. Doing this has no effect on the printed
output
but makes the fields easier to work with on-screen.

To see the inner workings of any field, select it and press
Shift-F9. When
you're done, pressing Shift-F9 again will toggle the display back
to showing
the field's results. Alternatively, if you press F9, the field will
update
and toggle the display back to showing the field's results in one
go.


The only place that you have to "mark something as a "key" field"
is in your
mind.

--
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, originally posted via msnews.microsoft.com

"mom2dramaqeen" wrote in
message
...
And if I bookmark the "key" then how exactly do I tell the fields
to look
at
it? I don't have a clue, that's why your document is over my
head and I
need
more basic guidance. Once I know this part then I'm probably
fine with
the
rest, but I've never done this before but have a huge need to
learn.


"mom2dramaqeen" wrote:

That's the thing. I've read your documents, and it makes no
sense to me
what
I'm suppose to do.

I have no clue how to mark something as a "key" field. I know
which one
I
want to sort by, but I have no clue how to tell it that. I'm
looking at
your
page 3 and I cannot even get the example you give to produce a
sorted
list
like you have becuase I don't know how to tell the system this
is the
key.

Am I to Bookmark the field, if so how?



"macropod" wrote:

Hi mom2dramaqeen,

The process is fully explained in my my Word 97-2007
Catalogue/Directory Mailmerge Tutorial at:
http://www.wopr.com/index.php?showto...#entry731 107
or
http://www.gmayor.com/Zips/Catalogue%20Mailmerge.zip
Do read the tutorial (especially the Introduction) before
trying to use
the mailmerge document included with it.

--
Cheers
macropod
[MVP - Microsoft Word]


"mom2dramaqeen"
wrote in
message
...
I've read the other post on this and I'm still lost.

I have a file sorted by a "key" code that I want to send an
email
mail merge
and have all "rows" from my data source that have this same
"key" on
that one
email, before the next email is made.

I've read the articles posted and I'm completely confused.
I don't
know how
in my document to mark my "key" field as a the key. I don't
understand how
to or where at in my main document to do this.

Can someone help me and be more specific.

here is an example of what I'm working with:
Key Fname Lname Salary
001-090 Joe Smith 20,000
001-090 Suzie Smith 15,000
001-091 Bob James 20,000
002-090 Jan Jones 20,000

This data is in excel, I know how to create a normal main
document
and
connect to my data source. My data source is sorted by the
key. I
want my
document to have a letter type formate containing generic
informaiton
with a
table of the people who have the problem. So for example
001-090
should have
two rows in the table One for Joe and then another line for
Suzie,
but
001-091 would only have one.

Please help.











 




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 08:17 AM.


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