G
Greg Casper
I have a button on a form and I want it to print a Word mail merge document
that contains data from the database that is linked to my application.
I'm using the following code but always get a 5922 error - Word can't
open the source... All variable names contain valid data, so that's NOT
the problem.
With appWord
.Visible = True
.Documents.Open pathdocname
With .ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
strConnection = "DSN=MS Access Databases;" _
& "DBQ=" & strFileName _
& "FIL=RedISAM;"
.OpenDataSource Name:=strFileName, LinkToSource:=True,
ReadOnly:=True, _
Connection:=strConnection, _
SQLStatement:="SELECT * FROM People WHERE !ContactID =
People.ContactID"
End With
Even if I take out the WHERE clause, it doesn't work. It just won't
connect.
WHAT AM I DOING WRONG???
Thanks folks...
that contains data from the database that is linked to my application.
I'm using the following code but always get a 5922 error - Word can't
open the source... All variable names contain valid data, so that's NOT
the problem.
With appWord
.Visible = True
.Documents.Open pathdocname
With .ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
strConnection = "DSN=MS Access Databases;" _
& "DBQ=" & strFileName _
& "FIL=RedISAM;"
.OpenDataSource Name:=strFileName, LinkToSource:=True,
ReadOnly:=True, _
Connection:=strConnection, _
SQLStatement:="SELECT * FROM People WHERE !ContactID =
People.ContactID"
End With
Even if I take out the WHERE clause, it doesn't work. It just won't
connect.
WHAT AM I DOING WRONG???
Thanks folks...