Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Jim Jim is offline
external usenet poster
 
Posts: 192
Default Word 2007 mailmerge from Access 2007

We have created a mail merge document, "Deposit Letter.docx" created in Word
2007, whereas the datasource is a paramenter query created in Access 2007,
which is connected by a DDE connection. The word document can be opened from
inside Access by selecting a button that has the command attached. The
problem we have is when the document is selcted to be opened, it does not
retrieve the data created by the query. It opens but will only show one
page(the document will have multiple pages), that has old data inserted. To
have the document show the current data from the query, the mail merge wizard
has to be started and that whole process has to be completed each time. It
seems to not keep the connection between the two applications.

The goal is when the document is opened, the data from the query is inserted
without having to go through the whole mail merge process. Thanks for any
assistance.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Word 2007 mailmerge from Access 2007

You /probably/ need to apply the registry change described in

http://support.microsoft.com/kb/825765/en-us

--
Peter Jamieson
http://tips.pjmsn.me.uk

"jim" wrote in message
...
We have created a mail merge document, "Deposit Letter.docx" created in
Word
2007, whereas the datasource is a paramenter query created in Access 2007,
which is connected by a DDE connection. The word document can be opened
from
inside Access by selecting a button that has the command attached. The
problem we have is when the document is selcted to be opened, it does not
retrieve the data created by the query. It opens but will only show one
page(the document will have multiple pages), that has old data inserted.
To
have the document show the current data from the query, the mail merge
wizard
has to be started and that whole process has to be completed each time. It
seems to not keep the connection between the two applications.

The goal is when the document is opened, the data from the query is
inserted
without having to go through the whole mail merge process. Thanks for any
assistance.


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Jim Jim is offline
external usenet poster
 
Posts: 192
Default Word 2007 mailmerge from Access 2007

I did change the registry key per the help document, but now I get a run-time
error 5640. Debugging the error, it highlights oApp.Documents.Open
FileName:=LWordDoc in the module shown below.

Private Sub Command0_Click()


Dim LWordDoc As String
Dim oApp As Object

'Path to the word document
LWordDoc = "I:\Deposit Letter.docx"

If Dir(LWordDoc) = "" Then
MsgBox "Document not found."

Else
'Create an instance of MS Word
Set oApp = CreateObject(Class:="Word.Application")
oApp.Visible = True

'Open the Document
oApp.Documents.Open FileName:=LWordDoc
End If

Thanks for the help.

"Peter Jamieson" wrote:

You /probably/ need to apply the registry change described in

http://support.microsoft.com/kb/825765/en-us

--
Peter Jamieson
http://tips.pjmsn.me.uk

"jim" wrote in message
...
We have created a mail merge document, "Deposit Letter.docx" created in
Word
2007, whereas the datasource is a paramenter query created in Access 2007,
which is connected by a DDE connection. The word document can be opened
from
inside Access by selecting a button that has the command attached. The
problem we have is when the document is selcted to be opened, it does not
retrieve the data created by the query. It opens but will only show one
page(the document will have multiple pages), that has old data inserted.
To
have the document show the current data from the query, the mail merge
wizard
has to be started and that whole process has to be completed each time. It
seems to not keep the connection between the two applications.

The goal is when the document is opened, the data from the query is
inserted
without having to go through the whole mail merge process. Thanks for any
assistance.



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Word 2007 mailmerge from Access 2007

I suggest you try creating the mail merge link in VBA once you have opened
the document.

e.g., ensure that the document is not a mail merge main document (you will
lose any sort/filter stuff, but all the fields should remain), then in your
code, use something like

Dim oDoc As Object 'or Word.Document if you want early binding
Set oDoc = oApp.Documents.Open FileName:=LWordDoc
oDoc.Mailmerge.OpenDataSource _
Name:="the full path name of your database", _
.Connection:="QUERY [the query name]", _
.SQLStatement:="SELECT * FROM [the query name]", _
.Subtype:=wdMergeSubtypeWord2000


' then make sure othe oDoc.MailMerge properties such as mail merge type and
destination are set the way you want.

' eventually, set oDoc = Nothing

This is on-the-fly so I can't be sure that the parameters for OpenDataSource
are correct in this case. You'll need this Subtype for Word 2002 and later
to get a DDE connection, but you may be able to ditch the SQLStatement and
the Connection may need to be different. You can inspect values for an
existing DDE-connected document using VBA.

Alternatively, you may find Albert Kallal's stuff at (I think)

http://www.members.shaw.ca/AlbertKal.../msaccess.html

a more reliable way to do this.



--
Peter Jamieson
http://tips.pjmsn.me.uk

"jim" wrote in message
...
I did change the registry key per the help document, but now I get a
run-time
error 5640. Debugging the error, it highlights oApp.Documents.Open
FileName:=LWordDoc in the module shown below.

Private Sub Command0_Click()


Dim LWordDoc As String
Dim oApp As Object

'Path to the word document
LWordDoc = "I:\Deposit Letter.docx"

If Dir(LWordDoc) = "" Then
MsgBox "Document not found."

Else
'Create an instance of MS Word
Set oApp = CreateObject(Class:="Word.Application")
oApp.Visible = True

'Open the Document
oApp.Documents.Open FileName:=LWordDoc
End If

Thanks for the help.

"Peter Jamieson" wrote:

You /probably/ need to apply the registry change described in

http://support.microsoft.com/kb/825765/en-us

--
Peter Jamieson
http://tips.pjmsn.me.uk

"jim" wrote in message
...
We have created a mail merge document, "Deposit Letter.docx" created in
Word
2007, whereas the datasource is a paramenter query created in Access
2007,
which is connected by a DDE connection. The word document can be opened
from
inside Access by selecting a button that has the command attached. The
problem we have is when the document is selcted to be opened, it does
not
retrieve the data created by the query. It opens but will only show one
page(the document will have multiple pages), that has old data
inserted.
To
have the document show the current data from the query, the mail merge
wizard
has to be started and that whole process has to be completed each time.
It
seems to not keep the connection between the two applications.

The goal is when the document is opened, the data from the query is
inserted
without having to go through the whole mail merge process. Thanks for
any
assistance.




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mailmerge Access 2007 query jim Mailmerge 3 September 15th 08 03:46 PM
Mailmerge from Access 2007 to Word 2007 .docx document Russell Profitt[_3_] Mailmerge 0 March 20th 08 12:16 PM
Word 2007 Mailmerge with Access 2007 using DDE Russell Profitt Mailmerge 0 March 14th 08 01:11 PM
insert Access 2007 database table into a Word 2007 doc and print Leedell Microsoft Word Help 0 October 20th 07 08:10 AM
Word 2007 and Outlook 2007 e-mail MailMerge does not complete Account Manager Mailmerge 1 July 2nd 07 09:13 AM


All times are GMT +1. The time now is 10:05 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"