Not sure you saw this messge on another branch of the thread:
Have you applied the registry change described in
http://support.microsoft.com/kb/825765/en-us
?
If you don't do it, the chances are that your mail merge main document
will
not be connected to its data source when you open it.
--
Peter Jamiesonhttp://tips.pjmsn.me.uk
On Jan 17, 2:41 pm, "swdev2" <
[email protected]>
wrote:
Daniel -
AH !
I've seen this in production systems that I touch in the last year.
The BFAI approach to fix:
1. open the existing document.
2. copy all contents
3. close the existing document.
4. open new document
5. paste into new document
6. Setup the merge file, merge fields.
7. Save as the same file name as #1
W2003 gets confused sometimes, and near as I can tell, it's not a data
error, it's a W2003 error.
Recreating the document in the manner I described makes the problem go
away.
Should take you 20 minutes
or less for these 7 steps.
It's a PITA.
Mondo Regards [Bill]
--
===================
William Sanders / EFG VFP / mySql /
MS-SQLwww.efgroup.net/vfpwebhostingwww.terrafox.netwww.viasqlserver.net
On the .execute.
Does the error happen when you open the document or on the .Execute?
Elsewhere?
Dan
Daniel Williams wrote:
Not sure which Foxpro group you asked in, but I've added the place
you're most likely to get an answer.
It's unclear exactly what you're doing here, but from context I'm
guessing that when you say "in code" you mean in *Foxpro* code.
What does that code look like? <g> What are you doing? What error
messages are you getting? What symptoms are you seeing?
Dan
Daniel Williams wrote:
Hi, I am having trouble doing mail merges within foxpro 9. There
are
three separate documents involved here, linked to three different
foxpro tables with ODBC. When I open these documents in Word by
itself, it is able to merge all of them.
When I try to do this programmatically or with the mail merge
wizard in foxpro, strangely enough, only one of the documents
merges and two of them do not. And this problem popped up only
after switching to word 2003.
I have already asked this question before in a foxpro newsgroup
and
got no response whatsoever, so I am wondering, do I need to do
something differently with word 2003, like change a certain
setting
in it? Or is this definitely a foxpro problem?
Yeah, I meant Foxpro code. Sorry for the ambiguity. There's no code
in
the documents themselves.
This is the error in Word when the merge is attempted :
"Invalid Merge Field"
"This field exists in the main document, but does not exist
in the data source"
"You can remove the invalid merge field from the document"
"Or, you can replace it with a valid merge field from the data
source"
Then I'm given a choice between 'M__' and 'M__1'. Neither field
exists
in the table, but somehow
they're a choice.
This same exact error message pops up for every single merge field,
all of which really do exist in the table.
Not sure how much of the code you want to see, but this is
everything
I can see the merge depends upon :
#Define wdDefaultFirstRecord 1
#Define wdDefaultLastRecord -16
#Define wdSendToNewDocument 0
#Define wdFormatDocument 0
#Define wdDialogFilePrint 88
lcday=Dmy(Date()) &&day month year
lcdefaultpath=' ' &&default path
lcletterdir=' ' &&letter is stored here
lcdrive=Sys(5) &&default drive letter
lcdefaultpath=Alltrim(lcdefaultpath)+Sys(2003) &&gets default
path
lcletterdir=Alltrim(lcdrive)+Alltrim(lcdefaultpath) &&Gets the
letter directory
lcformletpath=Alltrim(lcletterdir)+"\letters\rental insp 1st
notice.doc" &&Gets the form letter
lcsaveletter=Alltrim(lcletterdir)+"\Sent letters\first"+lcday
+".doc" &&sETS PATH AND NEW NAME FOR MERGED LETTER
With Thisform.mailmerge1
.capptitle ="BICEPS First Notice Word Merge" && application name,
used in alerts
.nwordproc = 1 && word processor (1 = word 6+; 2 = commadelim; or
user-defined (see below);default = 1)
.nnewdoc = 2 && is it a new doc (1 = new, 2 = existing; default =
1)
.cdocname = lcformletpath
.ntemplate = 1 && type of main document (word only, 1 = form
letter; 2 = label; 3 = envelope; 4 =catalog; default = 1)
.calias = Alias() && alias of source table or view
.cdbctable = Dbf() && table name if table is part of a dbc
.cdbcname = Dbc() && dbc name if source table is part of a dbc
.makeoutput() && do the merge
With .oword
With .activedocument.mailmerge
* make new doc
.destination = wdsendtonewdocument
* remove blank lines
.suppressblanklines = .T.
With .Datasource
* set range of records
.firstrecord = wddefaultfirstrecord
.lastrecord = wddefaultlastrecord
Endwith && .datasource
* do the merge
.execute()
Endwith && .activedocument.mailmerge
* save merged document
.activedocument.SaveAs(lcsaveletter,wdformatdocument)
* make merge source form not visible
.Windows(1).Visible = .F.
* store old background printing setting
lloldprintbackground = .options.printbackground
* turn off background printing, it causes problems
.options.printbackground = .F.
* restore old background printing setting
.options.printbackground = lloldprintbackground
* close merged document
.activedocument.activewindow.Close(.F.)
* close mailmerge form without saving
.activedocument.Close(.F.)
* quit word
.Quit()
Endwith && .oword
.oword = ""
Endwith && thisform.mailmerge1
What "confuses" Word 2003?