
Am I being thick or what ?
Help !
I'm trying to get mail merge working with VB5, Word97, and Access97.
I looked at the MS help example (with VB3.0 !) and that seemed to work
OK.
I created a Data Source in the ODBC32 Control Panel Applet simply
with a name and pointing to my Access database.
I created a Mail Merge Source File in Word with fields from the Access
database.
Then ....
I wrote/copied the following code :
===============================================================
Dim sWordObject As Object, sS As String
Set sWordObject = CreateObject("Word.Basic")
sWordObject.AppShow
sWordObject.FileOpen Name:="C:\My Documents\MM.DOC"
sS = "SELECT DISTINCTROW Surname, Forename FROM WCS_PrintLists "
sWordObject.MailMergeOpenDataSource "", 0, 0, 0, 0, "", "", 0, "",
"", "DSN=WCS;DBQ=C:\Apps\WCS\WCS.mdb;FIL=RedISAM;", sS, ""
sWordObject.MailMergeToDoc
Set sWordObject = Nothing
===============================================================
And I get the following error :
'Run Time Error 1826 - Word was unable to open the data source'
Has ANYONE any idea why !
I would be eternally grateful for any help received.
Thanks
Tim