Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Mail merge on an access query... | Mailmerge | |||
Merge with Access Query | Mailmerge | |||
Mail Merge From Access Query | Mailmerge | |||
Mail Merge from Access Query | Mailmerge | |||
How do I Mail Merge from an Access Query? | Mailmerge |