ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pass a command text in pivot table (https://www.excelbanter.com/excel-programming/437446-pass-command-text-pivot-table.html)

SteAXA

Pass a command text in pivot table
 
I've got a pivot table with data give back by odbc (in excel 2003).
When i pass a new sql command, it answer me the database, also if i pass the
connection string. My code is this:

With ActiveSheet.PivotTables(sNamePivot).PivotCache
.CommandText = sSelect
.Connection = "ODBC;DSN=DS;DB=" & NomeDB & ";SRVR=;UID=SYSADM;PWD="
.Refresh
End With

sNamePivot -- string variable contain the correct name of the pivot table.
NomeDB -- string variable contain the database.
sSelect -- variable contain the sql command.

Why does it called me the database, if i pass also the connection???
Thanks for every help.

Ps. if i don't pass the commandtext, macro updating the pivot without call
me the database.


All times are GMT +1. The time now is 12:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com