Solved

Merging fields after a table

Posted on 2011-09-09
19
391 Views
Last Modified: 2013-11-24
I have a mail merge form letter that is pulling data from a SQL database.
There are several merge fields above a table, then a table which has numberical figures pulling.
Everything above and in the table pulls fine.
In the last row of the table there is a function to sum the numbers above. This also works fine.

However, after the table there is another merge field. That last merge field will not pull.
It remains blank once the document is assembled. Everything is mapped properly.
I have several documents like this and they all stop after the table and the remaining fields are left blank.
Is it possible to pull additional fields after the table?


0
Comment
Question by:timhwag73
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 4
  • +1
19 Comments
 

Author Comment

by:timhwag73
ID: 36511819
Thanks
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 36512506
I have just
done a simple test with Access and Word 2007, and that works OK
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 36512517
Sorry about the vertical space. I think I clicked one of the RTF buttons above the edit box.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:timhwag73
ID: 36512621
Unfortunately, it is still not working for me.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 36512766
This is the first time that I have heard that problem

Here is a main document and a CSV datasource file. Does it have the same problem?


MergeTable.doc
Contacts.csv
0
 

Author Comment

by:timhwag73
ID: 36512970
Mine is a little different in that I want all the info to pull to one table. I have attached my document.  mergefields.DOC
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 36514141
Hmm.

You have a Next Record field on each row of the the table, so that it looks like a combination of Labels, Directory and Letters type of main document.

I suspect that the Merge process treats it as a Label type. I'll try to find some sort of workaround.

Post a prompting comment if you think I'm taking too long (> 24 hours)
0
 
LVL 42

Expert Comment

by:pcelba
ID: 36514311
This works fine with SQL or DBF data in Word 2007.

The last field remains empty when the data table contains less than 20 rows. <<F2>> field at the bottom of the page is pulled from the 20th data row and if there is less number of rows or if the F2 field is empty then nothing is printed.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 36514411
pcelba,

That looks like a very relevant comment. If there aren't enough data to fill the table, then the merge will stop.
0
 

Author Comment

by:timhwag73
ID: 36518872
I put in 20 rows to capture all possibilities, as all letters assembles will contain a different number of rows.
F2 is not a blank field so maybe I should try it using less rows or a next record if statement? I'll try that and post my results.
0
 
LVL 42

Expert Comment

by:pcelba
ID: 36518918
Yes, if you disable the Next Record statement at the last record somehow then the F2 field from the last record will be on output.
0
 

Author Comment

by:timhwag73
ID: 36524795
I brought the row count down to 3 and assembled, and for this particular record, which had three rows of data, it worked perfectly. All of my records will have a different number of rows which contain data. Any ideas how to account for those which may need more rows?
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 36524955
The problem comes if the number of records in the datasource is not divisible by the number of rows in the table, because the merge process stops when the last record in the source has been processed.
0
 
LVL 42

Accepted Solution

by:
pcelba earned 500 total points
ID: 36525202
OK, you have to add one more row and one more column which will indicate the last row in your table and test this column before going to the next line. It means to use NEXTIF instead of NEXT:

{ NEXTIF { MERGEFIELD Fskip } <> 1 }«F3»

The value 1 in the Fskip column means "Don't skip to the next record". And the «F2» value will also be printed after the table. It, of course, means to print conditionaly all fields in the document - you'll see it when you try it.

More info is e.g. here: http://office.microsoft.com/en-us/word-help/field-codes-nextif-field-HP010077967.aspx
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 37196198
I've requested that this question be deleted for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 
LVL 42

Expert Comment

by:pcelba
ID: 37196199
Working solution was provided.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question