View Single Post
  #3   Report Post  
Marty
 
Posts: n/a
Default

Hi Cindy-

I am still using Word97. There are 2 connections. The first is:

WordBasic.MailMergeMainDocumentType 0
WordBasic.MailMergeOpenDataSource Name:="", ConfirmConversions:=0,
ReadOnly:=0, LinkToSource:=0, AddToMru:=0, PasswordDoc:="", PasswordDot:="",
Revert:=0, WritePasswordDoc:="", WritePasswordDot:="",
Connection:="DSN=NCR-SQL;UID=sa;PWD=;APP=Microsoft
Query;WSID=SHIVAINDRA;LANGUAGE=us_english;DATABASE =lp_patents",
SQLStatement:="execute splp_lppci " & Chr(34) & OrderLetterNumber & Chr(34),
SQLStatement1:=""
WordBasic.MailMerge CheckErrors:=1, Destination:=0, MergeRecords:=0,
From:="", to:="", Suppression:=0, MailMerge:=1, MailSubject:="",
MailAsAttachment:=0, MailAddress:=""


The second is:

lpmcn.Open "DSN=NCR-SQL;uid=sa;pwd=;database=LP_Patents"
Set cmd.ActiveConnection = lpmcn
cmd.CommandText = "SELECT lpm_order_letter_no, lpm_applicant_code,
lpm_country_code, lpm_agent_code, lpm_prefix_no, lpm_case_no, lpm_suffix_no,
lpm_filing_date, lpm_all_countries_flag, lpm_crp, lpm_kind_of_protection,
lpm_international_appl_no, lpm_auxiliary_client_designation, lpm_drawings,
lpm_small_entity, lpm_parent_date, lpm_parent_order_letter_no,
lpm_int_appl_date, lpm_convention, lpm_international_appl_no FROM LPMain
WHERE lpm_order_letter_no = '" & OrderLetterNumber & "'"
lpmrs.CursorLocation = adUseClient
lpmrs.Open cmd, , , adLockUnspecified


Not sure why I have 2 connections, but someone told me to do it this way.

Instead of "NCR-SQL" it used to have the name of the old server. On my local
PC, I have ODBC connections to both the old and new servers. The template
works fine. When I take out the connection to the old server, Word I get a
Data Source Not Found Error.

I put a breakpoint in my AutoOpen module of the macro. It never gets there.
The error pops up first.

When I first created the template, I seem to remember going into MailMerge
Helper and going through all 3 steps: Creating Main Document, Data Source and
Merge the two.

Somehow I feel that this is what is "remembering" the old server name. I
think that I need to redefine the Data Source here, but I do not want to undo
all the coding that I have.

I sure hope that you can help me.

Thanks,

Marty


"Cindy M -WordMVP-" wrote:

Hi ?B?TWFydHk=?=,

Difficult to say; you don't give us a lot to go on. Are you still using Word 97,
or have you upgraded to another (which) version?

Did you try recording the new connection in a macro? Please copy/paste the macro
code you've tested in your reply.

About 2 years ago I wrote a mailmerge? macro? in Word97 which opens forms,
asks questions then merges everything into a document. It worked fine until
we changed servers.

I changed both instances of the connection in the macro from the old server
name to the new.

In ODBC, I added the new SQL server connection and deleted the old one.

Now, when I try to run the template, Word gives an Open Database
Connectivity Error and says "Data source name not found and no default driver
specified."

What have I not done? When I search the entire project I do not find the old
server name.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)