A
Alex
Hi
I am using the following code to run a mail merge (taken from Microsoft web
site)in Access 2003
Function MergeIt()
Dim objWord As Object
Set objWord = GetObject("D:\temp\marketing letters\enable
brochurecd.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Contacts database.
objWord.MailMerge.OpenDataSource _
Name:="D:\temp\contacts.mdb", _
LinkToSource:=True, _
Connection:="TABLE tblOrganisations", _
SQLStatement:="SELECT * FROM [Customers]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
Instead of connecting to a table, I want to connect to a query. I have
tried to replace the table with the query but that doesn;t seem to work.
So I have to use the table and then enter the SQL from my query or have I
just got my syntax to link to a query wrong?
Thanks
I am using the following code to run a mail merge (taken from Microsoft web
site)in Access 2003
Function MergeIt()
Dim objWord As Object
Set objWord = GetObject("D:\temp\marketing letters\enable
brochurecd.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Contacts database.
objWord.MailMerge.OpenDataSource _
Name:="D:\temp\contacts.mdb", _
LinkToSource:=True, _
Connection:="TABLE tblOrganisations", _
SQLStatement:="SELECT * FROM [Customers]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
Instead of connecting to a table, I want to connect to a query. I have
tried to replace the table with the query but that doesn;t seem to work.
So I have to use the table and then enter the SQL from my query or have I
just got my syntax to link to a query wrong?
Thanks