Pass a command text in pivot table

S

SteAXA

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top