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\Dri vers;uid=w orkers;pwd =checking; database=D riving"
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.
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\Dri
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.
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:
C:\Windows\sysWOW64\odbcad32.exe
Also check if you do not have 64bit Windows this ODBC Manager to find your DSN entry:
C:\Windows\system32\odbcad32.exe
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
below is my string and I'm getting command failed error[
WordBasic.MailMergeMainDoc umentType 0
WordBasic.MailMergeOpenDat aSource Name:="", ConfirmConversions:=0, ReadOnly:=0, LinkToSource:=0, AddToMru:=0, PasswordDoc:="", PasswordDot:="", Revert:=0, WritePasswordDoc:="", WritePasswordDot:="", Connection:="Driver={SQL Server};Server=myserver-ne w-year\Dri vers;UID=e mpnum1;PWD =;APP=Micr osoft Query;WSID=myserver-new-ye ar\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:=""
WordBasic.MailMergeMainDoc
WordBasic.MailMergeOpenDat
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.
ASKER
Thank you gentlemen. This original question is working. Thanks again.
Look at this and choose some of the options suitable for you:
https://www.connectionstrings.com/sql-server/