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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail Merge in Word 2003 Combine Records

Status
Not open for further replies.

vise

Technical User
Joined
Jul 31, 2003
Messages
143
Location
US
Hi,
I'm having trouble getting the following to work for combining multiple records in word from an excel list.
I found a Microsoft KB that explained it for MS office 2000. However, I've found that the following code only works for the first two records in Office 2003. If anyone could be of assistance I would appreciate it.


DATA:
City Employee Sales
Atlanta Smith $3,000
Atlanta Gates $50,000
Atlanta Henderson $10,000
Houston Jones $8,000
Houston Kelley $9,000
Houston Peterson $0

CODE IN WORD:
{ IF { MERGESEQ } = "1" "{ MERGEFIELD City }" "" }<ENTER>
{ SET Place1 { MERGEFIELD City }}<ENTER>
{ If { Place2 } <> { Place1 }"<ENTER>
{ MERGEFIELD City }<ENTER>
<ENTER>
{ MERGEFIELD Employee }{ MERGEFIELD Sales }" "{ MERGEFIELD Employee }{ MERGEFIELD Sales }" }{ SET Place2 { MERGEFIELD City }}<ENTER>

Should produce

Atlanta

Smith $3,000
Gates $50,000
Henderson $10,000

Houston

Jones $8,000
Kelley $9,000
Peterson $0
 
I've figured out my own solution. Hopefully this helps others as well.
First you have to set the Document Type, which is a little document icon in the Mail Merge toolbar, to Directory. Then you go an select your data source and then perform the appropriate fields as listed above. This was not included in any of the tutorials on how this option was to be set.

So in the future, you do not need to include a {NEXT} after every line of fields if you need multiple ones. All you have to do is use the directory type and it will merge the data for you all you need is this simple code as listed.

HTH
 
Thanks, awesome tutorial. You should post it on this site as an FAQ as well.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top