Option Compare Database
Option Explicit
Public Sub RunPassThroughQuery() '(SQLString As String)
Dim oConn As ADODB.Connection
Dim oRec As ADODB.Recordset
Dim conStr As String 'connection string
Dim rConn As ADODB.Connection
Dim strDir As String
On Error GoTo ErrorHandle
Set rConn = CurrentProject.Connection
Set oConn = New ADODB.Connection
Set oRec = New ADODB.Recordset
With oConn
.CursorLocation = adUseClient
.CommandTimeout = 3600
.Open "Driver={Teradata};DBCName=[P5450];Database=[IW_Deflt_ProdDB_V];Connect Timeout=3600;Uid= abc;Pwd= 123"
End With
'Run the SQL command on the Teradata warehouse
'oRec.Open SQLString, oConn 'set other attributes if necessary
If oRec.RecordCount < 1 Then
MsgBox "There were no records to import. This is probably a bug, please contact development."
Exit Sub
End If
oRec.Close
oConn.Close
rConn.Close
Exit Sub
ErrorHandle:
MsgBox Error()
Exit Sub
End Sub
|