G
Guest
Hi,
I posted this in the input/export page and got some help, but my problem has
not been resolved. So, I thought I would try here.
I have the following module that will do a Word merge from a command button
on an Access form. I would like to replace the "Date()-395" with data
from a Date formated text box on the calling form. In other words, the
user would enter a date on the form and then click the command button which
would then do the merge using the entered date as the criteria. I tried many
optoins but usually get syntax errors. The form is called "Report Menu" and
the text box is "Event_Start_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
Thanks,
I posted this in the input/export page and got some help, but my problem has
not been resolved. So, I thought I would try here.
I have the following module that will do a Word merge from a command button
on an Access form. I would like to replace the "Date()-395" with data
from a Date formated text box on the calling form. In other words, the
user would enter a date on the form and then click the command button which
would then do the merge using the entered date as the criteria. I tried many
optoins but usually get syntax errors. The form is called "Report Menu" and
the text box is "Event_Start_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
Thanks,