Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Sam Sam is offline
external usenet poster
 
Posts: 68
Default merge with MS Access query underlying

I have the following code which opens a word document from MS Access 2003:

Dim LWordDoc As String
Dim App As Object

'Path to the word document
LWordDoc = "c:\ServerBackup\rptBUMC HxP.doc"

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

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

'Open the Document
App.Documents.Open filename:=LWordDoc
End If

The document is a mail merge document set up that way so I can populate it
with various data from my database. When I open the document, the underlying
query that populates the Word document (from MS Access) does not update. If I
open the document directly from Word, the query updates. Furthermore, if I
manually refresh the query in Access, the Word document still doesn't
refresh: it keeps the old data. How can I correct this?

Sam

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default merge with MS Access query underlying

1. Have you made the registry change described in

http://support.microsoft.com/kb/825765

?

Furthermore, if I
manually refresh the query in Access, the Word document still doesn't
refresh: it keeps the old data. How can I correct this?


In the user interface you may be able to open the Edit Recipients dialog
box and click Refresh. Programmatically, I do not know how you can do it
- at least not reliably. Possibilities - and that is all they are as I
have not investigated - include
a. changing the activerecord to be an earlier record than the current one
b. modifying the querystring, then reverting to the original one
c. closing and re-opening the data source
d. closing and re-opening the mail merge main document

(b), (c) and (d) would probably have to be accompanied by code to deal
with side-effects of modifying the data source.

Peter Jamieson

http://tips.pjmsn.me.uk

Sam wrote:
I have the following code which opens a word document from MS Access 2003:

Dim LWordDoc As String
Dim App As Object

'Path to the word document
LWordDoc = "c:\ServerBackup\rptBUMC HxP.doc"

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

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

'Open the Document
App.Documents.Open filename:=LWordDoc
End If

The document is a mail merge document set up that way so I can populate it
with various data from my database. When I open the document, the underlying
query that populates the Word document (from MS Access) does not update. If I
open the document directly from Word, the query updates. Furthermore, if I
manually refresh the query in Access, the Word document still doesn't
refresh: it keeps the old data. How can I correct this?

Sam

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
Mail merge on an access query... Warrio Mailmerge 2 September 16th 06 12:49 AM
Merge with Access Query rsw Mailmerge 8 June 12th 06 07:01 PM
Mail Merge From Access Query hspgapsemc Mailmerge 1 May 21st 06 07:07 AM
Mail Merge from Access Query KelMon Mailmerge 1 March 1st 05 01:52 AM
How do I Mail Merge from an Access Query? geordymac Mailmerge 2 February 9th 05 07:59 AM


All times are GMT +1. The time now is 07:39 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"