Hello,
I'm trying to pull table/view from Teradata via VBA without any joy.
Did look on few different websites and the closes one which is looking like working example would be
however for some reason it's failing on
line.
Any idea / guide ?
I'm trying to pull table/view from Teradata via VBA without any joy.
Did look on few different websites and the closes one which is looking like working example would be
Code:
Sub TBL()
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim cmdSQLData As ADODB.Command
Set cmdSQLData = New ADODB.Command
Dim query As String
cn.Open "DRIVER={Teradata}; DBCNAME=ABC2; Persist Security Info=True; User ID= USER; Password=PASS; Session Mode=ANSI;"
Set cmdSQLData.ActiveConnection = cn
query = "SELECT * FROM DB.TABLE;"
cmdSQLData.CommandText = query
cmdSQLData.CommandType = adCmdText
cmdSQLData.CommandTimeout = 0
Set rs = cmdSQLData.Execute()
dim dRst as dao.Recordset, fld as Variant
set dRst = CurrentDb.("tbl")
Do While Not Rs.EOF
dRst.AddNew
For Each fld in dRst.Fields
dRst.Fields(fld.Name) = rs.Fields(fld.Name)
Next
'Update an entire record:
dRst.Update
Rs.MoveNext: Loop
End Sub
however for some reason it's failing on
Code:
set dRst = CurrentDb.("tbl")
Any idea / guide ?