Can't connect to OpenDataSource

M

Marty

Hi-

I have 2 documents in Word97, each has a similar macro.
The 1st works fine, the second gives a connection error.
(MS Word error 1826: Word was unable to open data source.)

In the MailMergeOpenDataSource for the 1st, which works,
I have:

WordBasic.MailMergeOpenDataSource Name:="",
ConfirmConversions:=0, ReadOnly:=0, LinkToSource:=0,
AddToMru:=0, PasswordDoc:="", PasswordDot:="", Revert:=0,
WritePasswordDoc:="", WritePasswordDot:="",
Connection:="DSN=GAVURAH;UID=sa;PWD=;APP=Microsoft
Query;WSID=SHIVAINDRA;LANGUAGE=us_english;DATABASE=lp_pate
nts", SQLStatement:="execute splp_lppci " & Chr(34) &
OrderLetterNumber & Chr(34), SQLStatement1:=""

In the MailMergeOpenDataSource for the 2nd, which gives
an error, I have:

WordBasic.MailMergeOpenDataSource Name:="",
ConfirmConversions:=0, ReadOnly:=0, LinkToSource:=0,
AddToMru:=0, PasswordDoc:="", PasswordDot:="", Revert:=0,
WritePasswordDoc:="", WritePasswordDot:="",
Connection:="DSN=GAVURAH;UID=sa;PWD=;APP=Microsoft
Query;WSID=SHIVAINDRA;LANGUAGE=us_english;DATABASE=lp_pate
nts", SQLStatement:="execute splp_lppciUS " & Chr(34) &
OrderLetterNumber & Chr(34), SQLStatement1:=""

The names of the 2 stored proceedures are: splp_lppci and
splp_lppciUS. They run different queries.

The only difference in the MailMerge statements above is
the "US" in the name of the stored proceedure. (If I
remove the "US", then it doesn't give any error, but the
data are wrong, as this is not the stored proceedure that
I want to run.)

It doesn't appear that the statements are wrong, since if
I change the name of the stored proceedure, it connects.
The stored proceedures are good (I think) since they work
fine in Query Analyzer. The one called splp_lppci doesn't
cause a connection error, and the splp_lppciUS stored
proceedure does.

Am I missing an obvious thing here? Any ideas?

Thanks in advance for looking at this.
 
G

Guest

It always happens. I spend 2-3 days on a problem and
can't figure it out. So I post it. 10 minutes later I see
the answer.

Thanks for taking the time to look at this.

Much appreciated

-Marty
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top