Am I being thick or what ? 
Author Message
 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



Sun, 16 Jul 2000 03:00:00 GMT  
 Am I being thick or what ?

Tim,
        Unfortunately I don't have access to some old code of mine that did
mailmerge using word so I can't give you a code snipet but what you
haven't done IIRC is open or make the file C:\My Documents\MM.DOC a
mailmerge main document.

Quote:

> 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



Fri, 04 Aug 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. *** Am I being thick or what ? ***

2. *** Am I being thick or what ? ***

3. I am RILLY thick so pleez don't bother replying to this message :)

4. Am I thick or wot ?

5. Am I thick or what?

6. I am trying to update a record, i am not using data control

7. I am learning VB.NET and am wondering....

8. I am trying to update a record, i am not using data control

9. When is 5:00 AM not 5:00 AM? When it's 5:00 AM.

10. Am I missing something or am I just plain dumb?

11. Am I missing something???? Or Am I just Dumb????

12. Am I an .EXE, or am I running under VB env?

 

 
Powered by phpBB® Forum Software