P
Phil
Hi,
I have the following function in a module. In this function the
"Connection" is to an access TABLE. Is it possile to connect to a query
which is using two tables? If so, how would the function be changed? Would
the "TABLE" in the connection statement be changed to "QUERY" with the query
name? How would one reference the fields in the query for the SQLStatement:?
I have no idea if this can be done.
Thanks a lot....
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] > " & Format(Forms![Report
Menu]![Event_Start_Date], "\#mm\/dd\/yyyy\#") & ""
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
I have the following function in a module. In this function the
"Connection" is to an access TABLE. Is it possile to connect to a query
which is using two tables? If so, how would the function be changed? Would
the "TABLE" in the connection statement be changed to "QUERY" with the query
name? How would one reference the fields in the query for the SQLStatement:?
I have no idea if this can be done.
Thanks a lot....
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] > " & Format(Forms![Report
Menu]![Event_Start_Date], "\#mm\/dd\/yyyy\#") & ""
' Execute the mail merge.
objWord.MailMerge.Execute
End Function