#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default CommandText

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default CommandText

Shouldn't you qualify PivotCache(1)

--
Regards,
Tom Ogilvy

"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default CommandText

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...



"Tom Ogilvy" wrote:

Shouldn't you qualify PivotCache(1)

--
Regards,
Tom Ogilvy

"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default CommandText

Yes, that is what I mean.

--
Regards,
Tom Ogilvy


"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
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...



"Tom Ogilvy" wrote:

Shouldn't you qualify PivotCache(1)

--
Regards,
Tom Ogilvy

"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default CommandText

that is what I had when I got the error... still trying things... no success
yet...

"Tom Ogilvy" wrote:

Yes, that is what I mean.

--
Regards,
Tom Ogilvy


"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
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...



"Tom Ogilvy" wrote:

Shouldn't you qualify PivotCache(1)

--
Regards,
Tom Ogilvy

"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
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









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default CommandText

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!!!!

"Simon Shaw" wrote:

that is what I had when I got the error... still trying things... no success
yet...

"Tom Ogilvy" wrote:

Yes, that is what I mean.

--
Regards,
Tom Ogilvy


"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
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...



"Tom Ogilvy" wrote:

Shouldn't you qualify PivotCache(1)

--
Regards,
Tom Ogilvy

"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
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







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default CommandText

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.

--
Regards,
Tom Ogilvy

"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
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!!!!

"Simon Shaw" wrote:

that is what I had when I got the error... still trying things... no

success
yet...

"Tom Ogilvy" wrote:

Yes, that is what I mean.

--
Regards,
Tom Ogilvy


"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
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...



"Tom Ogilvy" wrote:

Shouldn't you qualify PivotCache(1)

--
Regards,
Tom Ogilvy

"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
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









  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default CommandText

How did you removed the PivotTable dependancies? I have the same error.

Thanx
Nick
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CommandText Property of importing external data [email protected] Excel Programming 2 April 8th 06 07:00 PM
Setting CommandText property of PivotCache fails if cache has 1 PivotTable ashortxl Excel Programming 1 May 20th 05 10:27 PM
CommandText Property Dick Kusleika[_3_] Excel Programming 0 October 17th 03 11:04 PM
change commandtext in pivotcaches patrick Excel Programming 3 September 2nd 03 03:06 PM


All times are GMT +1. The time now is 03:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"