drop Oracle table from VBA excel
Hi
I am strugling to run an Oracle procedure that drops a table from within an excel VBA script. The script returns an invalid ODBC connection 'ODBC--connection to Database failed' error '3151'.
I am wandering if I can run this kind of procedures from VBA? Before I ran some procedures that delete or insert records but this is the first time I'm trying to drop a table.
the script I'm using is this
Function droptab()
Dim db As Database, LConnect As String, ws As Workspace, LSProc As QueryDef
LConnect = "ODBC;DRIVER={ORACLE ODBC DRIVER};DSN=???;UID=???;SERVER=???"
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("", False, False, LConnect)
Set LSProc = db.CreateQueryDef("")
LSProc.Connect = LConnect
LSProc.Sql = "BEGIN droptabs; END;"
LSProc.ReturnsRecords = False
LSProc.ODBCTimeout = 0
LSProc.Execute
Set LSProc = Nothing
CallSProc = True
db.Close
Set db = Nothing
End Function
Any ideas?
Thanks
Pedro
|