F
fscs
I have a form that has two combo fields for filtering purposes. The first
combo has a list of queries and the second combo has a list of word
documents. I would like for my client to be able to select the query they
want to use and then select the letter that they want to merge the query
with and then have it merge in MS Word. I can get my merge code to use the
letter selected but I can't get it to use the query selected from the list.
Any help would be greatly appreciated.
Below is the code I am trying to use:
Dim objWord As Word.Document
Set objWord = GetObject(Me.Letter.Column(2), "Word.Document")
objWord.Application.Visible = True
objWord.MailMerge.OpenDataSource _
Name:="C:\Windows\Desktop\MailMergeTest.mdb", _
LinkToSource:=True, _
Connection:="Query QryLettersContributors", _
SQLStatement:="SELECT * FROM [QryLettersContributors]"
objWord.MailMerge.Execute
End Sub
Is it possible to use something like the example below?
Connection:= Me.QueryFilter
SQLStatement:= Me.QueryFilter
combo has a list of queries and the second combo has a list of word
documents. I would like for my client to be able to select the query they
want to use and then select the letter that they want to merge the query
with and then have it merge in MS Word. I can get my merge code to use the
letter selected but I can't get it to use the query selected from the list.
Any help would be greatly appreciated.
Below is the code I am trying to use:
Dim objWord As Word.Document
Set objWord = GetObject(Me.Letter.Column(2), "Word.Document")
objWord.Application.Visible = True
objWord.MailMerge.OpenDataSource _
Name:="C:\Windows\Desktop\MailMergeTest.mdb", _
LinkToSource:=True, _
Connection:="Query QryLettersContributors", _
SQLStatement:="SELECT * FROM [QryLettersContributors]"
objWord.MailMerge.Execute
End Sub
Is it possible to use something like the example below?
Connection:= Me.QueryFilter
SQLStatement:= Me.QueryFilter