M
mark
Hi.
I've been working with building PivotTables, in vb code, form external
Oracle sources.
I have it working, one way (the xlExternal data source, with the appropriate
..Connection property). But, the way that it is working still requires the
tnsnams.ora file to define what "DEV4" (the name of the database instance)
might mean, etc.
The other day, I was looking on the web and found an article about building
the connect string right into the code, eliminating the need for the
tnsnames.ora file.
The relevant code, minus the database username and password, is here:
<<<<<<<<<<<<<<
Dim strCon As String
strCon = "Driver={Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=HOSTLOC)(PORT=1526))" & _
"(CONNECT_DATA=(SID=DEV4))); uid=USER; pwd=PASS;"
Dim oCon As Object
Set oCon = CreateObject("ADODB.Connection")
Dim oRs As Object
Set oRs = CreateObject("ADODB.Recordset")
oCon.Open strCon
Set oRs = oCon.Execute("SELECT * from xxaai_test_lab_forecast")
<<<<<<<<<<<<<<<<<<
That works fine, and I can then go through and put that data into a
spreadsheet, should I happen to want to, which I don't.
But, I would like to know how to put that recordset into a pivot table,
somewhat directly.
Can anyone suggest a way to do that?
Thanks,
Mark
I've been working with building PivotTables, in vb code, form external
Oracle sources.
I have it working, one way (the xlExternal data source, with the appropriate
..Connection property). But, the way that it is working still requires the
tnsnams.ora file to define what "DEV4" (the name of the database instance)
might mean, etc.
The other day, I was looking on the web and found an article about building
the connect string right into the code, eliminating the need for the
tnsnames.ora file.
The relevant code, minus the database username and password, is here:
<<<<<<<<<<<<<<
Dim strCon As String
strCon = "Driver={Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=HOSTLOC)(PORT=1526))" & _
"(CONNECT_DATA=(SID=DEV4))); uid=USER; pwd=PASS;"
Dim oCon As Object
Set oCon = CreateObject("ADODB.Connection")
Dim oRs As Object
Set oRs = CreateObject("ADODB.Recordset")
oCon.Open strCon
Set oRs = oCon.Execute("SELECT * from xxaai_test_lab_forecast")
<<<<<<<<<<<<<<<<<<
That works fine, and I can then go through and put that data into a
spreadsheet, should I happen to want to, which I don't.
But, I would like to know how to put that recordset into a pivot table,
somewhat directly.
Can anyone suggest a way to do that?
Thanks,
Mark