View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SteAXA SteAXA is offline
external usenet poster
 
Posts: 22
Default 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.