View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default "too many data fields " error

MsgBox ActiveDocument.MailMerge.Fields.Count = 60
MsgBox ActiveDocument.MailMerge.DataSource.DataFields.Cou nt = 277


The first of these is related to the number of Word fields in the document
(well, certain types of fields, anyway) - e.g. if you just have one {
MERGEFIELD } field, the count should be 1.
The second is the number of columns in the data source, and as far as I
know, that means the number of columns in the header, not in the current
record.

So these two numbers describe completely different things.

However, that doesn't really help, so:
a. how many columns do you expect Word to find in the data source? Is it
60, 277, or something else?
b. If you execute the following VBA code and look at the results in the VBE
Immediate window, does that give you any clues about what is happening?

Sub showds()
Dim objDataField As MailMergeDataField
For Each objDataField In ActiveDocument.MailMerge.DataSource.DataFields
Debug.Print objDataField.Name, objDataField.Value
Next
End Sub

Peter Jamieson
"zSplash" zNOSPAMSplash@ gci.net wrote in message
...
When I run my mail merge for a single record, I get no errors. When I run
the mail merge with more than one record, I get a "Record contained too
many
data fields" error.

Others' help with this question suggested "usually caused by a mismatch
between the number of fields listed in the header record of the data
source
and the number of fields Word finds in the data records." I have tried to
compare these two, but evidently they're REALLY different, unless I'm
misinterprinting the following:
MsgBox ActiveDocument.MailMerge.Fields.Count = 60
MsgBox ActiveDocument.MailMerge.DataSource.DataFields.Cou nt = 277

My delimiter is "|", and I don't believe it's anywhere it shouldn't be.
As
I've said, individual records work great, but multiple records give me
this
error, and generate only one document.

Any suggestions as to how to solve this problem?

TIA