From Phil to Phil
I done a lot of research on this item and here is the best solution I've
come up with.
I have a form with a text box where the user enters the Word document name
and a command button which has the following code in the on-click event.
' my word documents are all in directory c:\Mailing List
' [Report Menu] is the form name with the text box and command button
' [MergeFile] is the text box with the word document name
Set objWord = GetObject("c:\Mailing List\" & Forms![Report
Menu]![MergeFile] & ".doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as Mailing List.mdb
' my Access file is Mailing List.mdb
' Query is MailMergeEvent
objWord.MailMerge.OpenDataSource _
Name:="c:\Mailing List\Mailing list.mdb", _
LinkToSource:=True, _
Connection:="QUERY MailMergeEvent", _
SQLStatement:="SELECT * FROM [MailMergeEvent]"
' SQLStatement:="SELECT Last_Name, First_Name, Organization, Address_1,
City, State, Zip FROM [MailMergeEvent]"
' be careful of the line wrap.....
I'm using Windows 98 and Access 2000 and it works fine. The word document
opens and then you click on "merge" or the merge icon. I tried to run my
db on a XP computer using Access 2003 and it only works if you open the form
and then go into design view and then back to regular view. I don't know
why. I'm posting this problem to the newsgroup in hopes of help.
Good luck