Avatar of Ronald popo
Ronald popo
 asked on

ADO Connection issue

Hi everyone,
I have a word template that merges data from a sql DB.  I did not write it.  The server crashed and a new server was installed.  I am having a connection problem.  It is a template that was written prior to 2005.

This is part of the code concerning the connection

Public drive As New ADODB.Connection
Public cmd As New ADODB.Command
Public DOTainCntFlag As String

in addition:

Public Sub GetLPMain()
On Error GoTo Err_GetLDriving
Dim sqlstring As String
Dim lpmrs As New ADODB.Recordset
' Connects to database and gets Driversrecord

Customer_num = [custNumber]

' Set ADO connection
drive.Open "DSN=myserver-new-year\Drivers;uid=workers;pwd=checking;database=Driving"
Set cmd.ActiveConnection = drive

I'm getting the following error.  I've googled it and still the same

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
DatabasesMicrosoft WordSQL

Avatar of undefined
Last Comment
Ronald popo

8/22/2022 - Mon

Look at this and choose some of the options suitable for you:



Sorry, you have to change your local ODBC DSN settings, not the connection string.

Open this Exe and look for your DSN Name and change the Config for your DSN entry:



Also check if you do not have 64bit Windows this ODBC Manager to find your DSN entry:


Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Ronald popo

below is my string and I'm getting command failed error[

WordBasic.MailMergeMainDocumentType 0
WordBasic.MailMergeOpenDataSource Name:="", ConfirmConversions:=0, ReadOnly:=0, LinkToSource:=0, AddToMru:=0, PasswordDoc:="", PasswordDot:="", Revert:=0, WritePasswordDoc:="", WritePasswordDot:="", Connection:="Driver={SQL Server};Server=myserver-new-year\Drivers;UID=empnum1;PWD=;APP=Microsoft Query;WSID=myserver-new-year\Drivers;LANGUAGE=us_english;DATABASE=Driving", SQLStatement:="execute splp_empcust " & Chr(34) & custnumbers & Chr(34), SQLStatement1:=""
WordBasic.MailMerge CheckErrors:=1, Destination:=0, MergeRecords:=0, From:="", To:="", Suppression:=0, MailMerge:=1, MailSubject:="", MailAsAttachment:=0, MailAddress:=""

Please write more details here on EE.

Nobody can look at your script lines and guess what is your environment and what is going wrong without  error message details.

Therefor post here your complette error message and state whether you use ODBC DSN or now you try to connect without local ODBC manager.

Ronald popo

Thank you gentlemen.  This original question is working.  Thanks again.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.