Q
quartz
I am using Office 2003 on Windows XP.
I am running the following code. This is running from a standard code module
in Excel, querying Oracle, and making a table into an Access DB. The problem
is, sometimes it runs fine, other times I get "ODBC Call Fails" error:
Dim sSQL as String
Dim sConnect as String
Dim sFullNameDB as String
sConnect = "PROVIDER=MSDASQL.1;DRIVER={ORACLE ODBC
DRIVER};SERVER=MyServer;DBQ=MyDBQ;UID=***;PWD=***;"
sFullNameDB = "C:\Temp\MyAccessDB.mdb"
sSQL = "SELECT "
sSQL = sSQL & "[GL].ACCTNO, "
sSQL = sSQL & "[GL].ACCOUNT_DESC, "
....<OTHER SQL - REMOVED FOR THIS EXAMPLE>...
sSQL = sSQL & "INTO "
sSQL = sSQL & "[IMPORT] "
sSQL = sSQL & "FROM "
sSQL = sSQL & "[ODBC;" & sConnect & "].[APPS.GLBALVW] AS [GL] "
sSQL = sSQL & "WHERE "
sSQL = sSQL & "[GL].PERIOD_NAME IN ('Sep-03', 'Sep-04') AND "
sSQL = sSQL & "[GL].FUND BETWEEN '800' AND '999' AND "
sSQL = sSQL & "[GL].ACCOUNT BETWEEN '0000' AND '8999';"
Set cnADO = New ADODB.Connection
cnADO.CommandTimeout = 0
cnADO.CursorLocation = adUseClient
cnADO.Provider = "Microsoft.Jet.OLEDB.4.0"
cnADO.ConnectionString = sFullNameDB
cnADO.Open
cnADO.Execute sSQL
cnADO.Close
Set cnADO = Nothing
Please note I have timeout set to zero.
Any help appreciated. Thanks in advance.
I am running the following code. This is running from a standard code module
in Excel, querying Oracle, and making a table into an Access DB. The problem
is, sometimes it runs fine, other times I get "ODBC Call Fails" error:
Dim sSQL as String
Dim sConnect as String
Dim sFullNameDB as String
sConnect = "PROVIDER=MSDASQL.1;DRIVER={ORACLE ODBC
DRIVER};SERVER=MyServer;DBQ=MyDBQ;UID=***;PWD=***;"
sFullNameDB = "C:\Temp\MyAccessDB.mdb"
sSQL = "SELECT "
sSQL = sSQL & "[GL].ACCTNO, "
sSQL = sSQL & "[GL].ACCOUNT_DESC, "
....<OTHER SQL - REMOVED FOR THIS EXAMPLE>...
sSQL = sSQL & "INTO "
sSQL = sSQL & "[IMPORT] "
sSQL = sSQL & "FROM "
sSQL = sSQL & "[ODBC;" & sConnect & "].[APPS.GLBALVW] AS [GL] "
sSQL = sSQL & "WHERE "
sSQL = sSQL & "[GL].PERIOD_NAME IN ('Sep-03', 'Sep-04') AND "
sSQL = sSQL & "[GL].FUND BETWEEN '800' AND '999' AND "
sSQL = sSQL & "[GL].ACCOUNT BETWEEN '0000' AND '8999';"
Set cnADO = New ADODB.Connection
cnADO.CommandTimeout = 0
cnADO.CursorLocation = adUseClient
cnADO.Provider = "Microsoft.Jet.OLEDB.4.0"
cnADO.ConnectionString = sFullNameDB
cnADO.Open
cnADO.Execute sSQL
cnADO.Close
Set cnADO = Nothing
Please note I have timeout set to zero.
Any help appreciated. Thanks in advance.