S
susanmgarrett
Goal: In Access 2000, To use an unbound field to choose a record from
a query, the data of which is merged into a launched copy of Word
2000.
I'm using the "How to Use Automation to Run Word 2000 Mail Merge from
Access" instructions from MS Knowledgebase, but I've never used a
module before.
The macro opens the select form and chooses the correct record when
data is input into the unbound field. Buttons work perfectly.
The module launches perfectly when I type ?MergeIt() in the immediate
window of the module.
How do I launch the module from within the macro so that after the
record is selected, Word will launch the document merge as contained
in the module?
Thank you for your assistance. Specifics below.
Regards
Susan M. Garrett
____________________________
Macro: conmha
1. Open Dialog
Action: Openform
FormName: Contract - Metal Hurlant Artist
Condition: Not IsLoaded("Contract - Metal Hurlant Artist")
Cancel Event
2. Close Dialog
Action: Close
Object Type: Form
Object Name: Contract - Metal Hurlant Artist
3. OKbutton
Action: SetValue
4. Cancelbutton
Action: Close
Object Type: Form
Object Name: Contract - Metal Hurlant Artist
Module: Mergewordmhaconart
Function MergeIt()
Dim objWord As Word.Document
Set objWord = GetObject
("C:\humanoids\docs\contractmhart.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Humanoids database.
objWord.MailMerge.OpenDataSource _
Name:="C:\humanoids\humanoids.mdb", _
LinkToSource:=True, _
Connection:="QUERY Query - ContractMHArt", _
SQLStatement:="SELECT * FROM [Query - ContractMHArt]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
a query, the data of which is merged into a launched copy of Word
2000.
I'm using the "How to Use Automation to Run Word 2000 Mail Merge from
Access" instructions from MS Knowledgebase, but I've never used a
module before.
The macro opens the select form and chooses the correct record when
data is input into the unbound field. Buttons work perfectly.
The module launches perfectly when I type ?MergeIt() in the immediate
window of the module.
How do I launch the module from within the macro so that after the
record is selected, Word will launch the document merge as contained
in the module?
Thank you for your assistance. Specifics below.
Regards
Susan M. Garrett
____________________________
Macro: conmha
1. Open Dialog
Action: Openform
FormName: Contract - Metal Hurlant Artist
Condition: Not IsLoaded("Contract - Metal Hurlant Artist")
Cancel Event
2. Close Dialog
Action: Close
Object Type: Form
Object Name: Contract - Metal Hurlant Artist
3. OKbutton
Action: SetValue
4. Cancelbutton
Action: Close
Object Type: Form
Object Name: Contract - Metal Hurlant Artist
Module: Mergewordmhaconart
Function MergeIt()
Dim objWord As Word.Document
Set objWord = GetObject
("C:\humanoids\docs\contractmhart.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Humanoids database.
objWord.MailMerge.OpenDataSource _
Name:="C:\humanoids\humanoids.mdb", _
LinkToSource:=True, _
Connection:="QUERY Query - ContractMHArt", _
SQLStatement:="SELECT * FROM [Query - ContractMHArt]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function