CommandText

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am trying to pass a String of SQL code into
Pivotcache(1).CommandText = Array (...., ..., ..., etc)

I keep getting the error message: Run-time error '1004' Application-defined
or object error. clicking Help doesn't tell me anything.

I have successfully passed SQL into the CommandText before, I thought I got
it to work by limiting the length of each element of the array...

When I take the SQL I am trying to pass in to the CommandText and paste it
directly into MS Query behind the PivotTable it works fine. so I know the SQL
code is valid.

Ideas?

Thanks

Simon Shaw
 
qualify?

do you mean:

With Workbooks("Report Template.xls").PivotCaches(1)
.CommandType = xlCmdSql
.CommandText = Array("SELECT ACCOUNT_NO, ACCOUNTING_DATE, AMOUNT,
APPROVAL, BASE_CURR_AMOUNT, CHART_ID, ", _ etc...
 
figured it out...!

the PivotCache I was trying to update had multiple PivotTables using it as
the source. When I fed the SQL into the PivotCache of a PivotTable without
any dependant PivotTables, it worked!!!!
 
Perhaps you aren't being clear. If a pivotcache doesn't have any dependent
pivot tables and you save the workbook, it will be deleted.
 

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

Back
Top