G
Guest
Hi,
I have the following module that will do a Word merge from a command button
on an Access form. My question: is it possible for the module to prompt for
data? I would like to replace the "Date()-395" with a variable that is
entered when the module is run. In other words, when the command button is
clicked and the module is processed I would like it to prompt the user for a
date.
Can this be done?
Thanks,
Phil
Function MergeIt()
Dim objWord As Word.Document
Set objWord = GetObject("MyMerge.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as Mailing List.
objWord.MailMerge.OpenDataSource _
Name:="Mailing List.mdb", _
LinkToSource:=True, _
Connection:="TABLE Mailing List", _
SQLStatement:="SELECT Last_Name, First_Name FROM [Mailing List] WHERE
((([Mailing List].[Current Membership Date])> Date()-395))"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
I have the following module that will do a Word merge from a command button
on an Access form. My question: is it possible for the module to prompt for
data? I would like to replace the "Date()-395" with a variable that is
entered when the module is run. In other words, when the command button is
clicked and the module is processed I would like it to prompt the user for a
date.
Can this be done?
Thanks,
Phil
Function MergeIt()
Dim objWord As Word.Document
Set objWord = GetObject("MyMerge.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as Mailing List.
objWord.MailMerge.OpenDataSource _
Name:="Mailing List.mdb", _
LinkToSource:=True, _
Connection:="TABLE Mailing List", _
SQLStatement:="SELECT Last_Name, First_Name FROM [Mailing List] WHERE
((([Mailing List].[Current Membership Date])> Date()-395))"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function