Hi all - I have a question already out there about this but just discovered another bug.
I can't run this Mail Merge off of a parameter query whose criteria is based on a forms values. This is because the code below is opening another instance of Access where (obviously) the form isn't open, just the switchboard.
Is there anyway I can force access to use the open active db as the data source rather than opening a new instance?
Code is below.
Thanks!
Andy
Function DenialMerge()
Dim objWord As Word.Document
Set objWord = GetObject("C:\Denial.doc", "Word.Document"
' Show Word.
objWord.Application.Visible = True
' Set the data source of the merge to CCDB.
objWord.MailMerge.OpenDataSource _
Name:="S:\CCDBv3.0\Front_End\CCDB_v3.01.mdb", _
LinkToSource:=True, _
Connection:="QUERY qry_Denial_Form_Test", _
SQLStatement:="SELECT * FROM [qry_Denial_Form_Test]"
' Run it!
objWord.MailMerge.Execute
' Protect Denial Worsheet!
ActiveDocument.Protect Password:="password", NoReset:=
False, Type:= _wdAllowOnlyFormFields
End Function
I can't run this Mail Merge off of a parameter query whose criteria is based on a forms values. This is because the code below is opening another instance of Access where (obviously) the form isn't open, just the switchboard.
Is there anyway I can force access to use the open active db as the data source rather than opening a new instance?
Code is below.
Thanks!
Andy
Function DenialMerge()
Dim objWord As Word.Document
Set objWord = GetObject("C:\Denial.doc", "Word.Document"
' Show Word.
objWord.Application.Visible = True
' Set the data source of the merge to CCDB.
objWord.MailMerge.OpenDataSource _
Name:="S:\CCDBv3.0\Front_End\CCDB_v3.01.mdb", _
LinkToSource:=True, _
Connection:="QUERY qry_Denial_Form_Test", _
SQLStatement:="SELECT * FROM [qry_Denial_Form_Test]"
' Run it!
objWord.MailMerge.Execute
' Protect Denial Worsheet!
ActiveDocument.Protect Password:="password", NoReset:=
False, Type:= _wdAllowOnlyFormFields
End Function