Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009
    Posts
    1

    Unanswered: opendatasource error

    I'm having a little bit weird issue so bare with me.


    I have database A and database B and I also have computer C and computer D.

    computer C has access 2003 SP3 computer D has access 2003 SP2.


    I have database A working just fine on C and D and
    database B working on D.

    When I've created database B I've simply copied the following code.


    maindoc = "documentname"
    pname = "path"

    Dim objWord As Object

    Set objWord = GetObject("\\path\" & maindoc & "", "Word.Document")
    objWord.Application.Visible = True

    objWord.MailMerge.OpenDataSource Name:=pname, SQLStatement:="SELECT * FROM table "


    objWord.MailMerge.Execute


    the only difference between the code in database A and B is the name of the document I'm trying to merge.

    I'm receiving a run time error on computer C because the Name argument instead of picking up pname has a value of "Microsoft Access".

    any idea?

    If this is an SP issue then why on earth database A working fine?

    What am i missing?

    any help would be appriciated.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    What happens when you replace pname by its value, like this?

    Code:
    objWord.MailMerge.OpenDataSource Name:="path"
    , SQLStatement:="SELECT * FROM table "
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •