LevelThought
MIS
Trying to connect to Oracle from Access in the testing of ADO to extract data.
Continue to get the error message "Ora 12154: TNS: Could not resolve service name" when I step through the code.
Currently reviewing Data Sources and TNS file to try to resolve.
Any idea as to a resolution?
Sub CreateRecordset2()
'Declare and instantiate the connection
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
'Declare and instantiate the recordset
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
'Open the connection
cnn.Open "Provider=MSDAORA;Data source=VTT;UserId=VF_jacxd;Password='rtJU45C';Persist Security Info=True"
'Use the ActiveConnection property of the recordset object
'to supply the connection information
rst.ActiveConnection = cnn
'Open the recordset and print its contents
rst.Open "Select * from Customer_Detail"
Debug.Print rst.GetString
'Close and destroy the recordset object and the connection object
rst.Close
Set rst = Nothing
cnn.Close
Set cnn = Nothing
End Sub
Continue to get the error message "Ora 12154: TNS: Could not resolve service name" when I step through the code.
Currently reviewing Data Sources and TNS file to try to resolve.
Any idea as to a resolution?
Sub CreateRecordset2()
'Declare and instantiate the connection
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
'Declare and instantiate the recordset
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
'Open the connection
cnn.Open "Provider=MSDAORA;Data source=VTT;UserId=VF_jacxd;Password='rtJU45C';Persist Security Info=True"
'Use the ActiveConnection property of the recordset object
'to supply the connection information
rst.ActiveConnection = cnn
'Open the recordset and print its contents
rst.Open "Select * from Customer_Detail"
Debug.Print rst.GetString
'Close and destroy the recordset object and the connection object
rst.Close
Set rst = Nothing
cnn.Close
Set cnn = Nothing
End Sub