Well, can use ms-access to "set" the document if it is relative to the
ms-access document. You can always open the merge doc, and set the merge
path (data source) (so, I guess that would accomplish the same thing). The
only thing I would not like is that fact that you would be modifying the
template each time.
So, fire up word, turn the macro recorder on, and then attach the mdb file.
You then can steal the code from word that sets the data source and paste it
into your code in ms-access. You then modify the code so that the path is
set each time.
The following code is to set the merge file to a text file, but the idea
would be the
same for a mdb file.
WordDoc.MailMerge.MainDocumentType = 0 ' wdFormLetters = 0
WordDoc.MailMerge.OpenDataSource _
Name:=strSaveDir & TextMerge, _
ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=0, _
Connection:="", SQLStatement:="", SQLStatement1:=""
' write doc to disk....
WordDoc.SaveAs FileName:=strSaveDir & strNewName, _
FileFormat:=0, _
LockComments:=False, Password:="", AddToRecentFiles:=False,
WritePassword:="", _
ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False,
SaveAsAOCELetter:=False
As mentioned, get the word macro recorder to make the above (I did not type
the above!!!), and then just change the hard code to strSaveDir &
strFileName.
You then just need code to set-up the SaveDir and FileName. You can get the
current mdb dir via:
strDB = CurrentDb.Name
strDir = Left(strDB, Len(strDB) - Len(Dir(strDB)))