Export Access to Word template
Posted on 2008-10-29
I export an access report to a Word Template. Everything is working great.
With the installation of another computer, we want to share the database between the computers, too. Even that is working! The database and the templates are in a Mapped folder.
If I try to create the Word document from the "external" computer, the code line
'Set doc = wrdApp.Documents.Add(strPath & contemplate)' is set to NULL. The path and the file name are correct and can be monitored in step mode.
All computers have the right to read and write to the shared drive!
The "external" computer can regerate the word file with the data as a table in it (RTF file)!!
Who can help me?
' Export the data to rtf format
DoCmd.OutputTo acOutputQuery, conquery, _
acFormatRTF, strDataSource, False
' Start Word using mailmerge template
Set wrdApp = New Word.Application
Set doc = wrdApp.Documents.Add(strPath & contemplate) '<<<======
' Do the mail merge to a new document.
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
If .State = wdMainAndDataSource Then
' Display the mail merge document
wrdApp.Visible = True
wrdApp.WindowState = wdWindowStateMaximize
Set doc = Nothing
Set wrdApp = Nothing
HandleErrors: etc. etc. etc.