View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alok Alok is offline
external usenet poster
 
Posts: 318
Default DAO issue : Data source name not found

Hi,

Need your help.

I have code that uses DAO to establish connection with SQL Server. While it
works without problem on many computers, on one computer it is giving me the
following error:

Err:-2147467257 Error:[Microsoft][ODBC Driver Manager] Data source name not
found and no default driver specified

I am using the following code

Public Function GetADOConnectionToIRT(ByRef c As Connection) As Boolean
Dim cTemp As ADODB.Connection
On Error GoTo ErrorInGetADOConnection
Set cTemp = New ADODB.Connection
cTemp.Open ConnectionStringToIRT()
Set c = cTemp
GetADOConnectionToIRT = True
Exit Function
ErrorInGetADOConnection:
MsgBox "Err:" & Err & " Description:" & Error & vbCrLf & "Could not
establish connection."
Exit Function
End Function

Public Function ConnectionStringToIRT() As String
ConnectionStringToIRT = "Provider=SQLOLEDB;Data
Source=<SomeName;UID=<SomeUserID;PWD=<SomePWD"
End Function

I suspected that one of the MDAC components was probably missing and hence I
reinstalled Microsoft Access 2003 on it but with no luck.

The connection string does not change from computer to computer and hence
that does not seem to be the problem since it works on other computers.

All computers are on a LAN and use Windows 2K and Excel 2003.