Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Merging to MS Word Directory confusion

Status
Not open for further replies.

MrMode

Technical User
Aug 28, 2003
195
GB
I have tried to follow the various tutorials on merging to a Directory and I am not even close to getting it to work.

I am using Word 2003.

I am trying to make the example work so that I properly understand what is going on, therefore, I have copied the MS excel data file in the "How to Set Up the Data File" example and used ctrl+F9 to set up the field braces

I have simply put the text "The data you want" before the merge fields. I put the merge fields on the document and copied them into the code to ensure there were no typos (I noticed that Word 2003 puts the field in quotation marks)

Code:
{ IF { MERGESEQ } = "1" "{ MERGEFIELD "CITY" }
" "" }{ SET Place1 { MERGEFIELD "CITY" }}
{ If { Place2 } <> { Place1 }"
{ MERGEFIELD "CITY" }

{ MERGEFIELD "EMPLOYEE" } { MERGEFIELD "SALES" }" "{ MERGEFIELD "EMPLOYEE" } { MERGEFIELD "SALES" }" }{ SET Place2 { MERGEFIELD "CITY" }}

When I merge to a new document, instead of the data coming through sorted i.e.

"The data you want
Atlanta
Smith £3000
Gates $50000" etc

I get
"The data you want
Atlanta
Smith £3000

The data you want

Gates $50000" etc

Which suggests to me that it is partially 'sorting' the data, but I do not know why it is not inserting the data for related records all beneath the city? What am I doing wrong?

 
Your output suggests there are changes in the city data. Regardless, for a more comprehensive implementation, with field codes you can simply copy/paste and a demo data source, check out my Microsoft Word Catalogue/Directory Mailmerge Tutorial at:
or:
The tutorial covers everything from list creation to the insertion & calculation of values in multi-record tables in letters. Do read the tutorial before trying to use the mailmerge document included with it.

The field coding for some examples is complex. However, since the tutorial document includes working field codes for all of its examples, most of the hard work has already been done for you - you should be able to do little more than copy/paste the relevant field codes into your own mailmerge main document, substitute/insert your own field names and adjust the formatting to get the results you desire. For some worked examples, see the attachments to the posts at:

Cheers
Paul Edstein
[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top