Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
lc lc is offline
external usenet poster
 
Posts: 13
Default PivotTable and connection string


With Excel 2003, I'm trying to replace connection string and make query
dynamic but am getting "strange" errors. This is what I have:

Private Sub refreshData(dFrom As Date, dTo As Date)
Dim pt As PivotTable
Dim pc As PivotCache

Set pt = Sheet1.PivotTables(1)
Set pc = ActiveWorkbook.PivotCaches(pt.CacheIndex)

pc.Connection = "SQLOLEDB.1;User ID=sa;Initial Catalog=QuantumPlan;Data
Source=myServer"
pc.CommandText = "select .... '"

pt.PivotCache.Refresh
End Sub

I'm getting 1004 error on pc.Connection line. Anyone has any idea why and
how to get around it?

Thanks a lot.

lc


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
How do I use a connection string? BrandenK Excel Discussion (Misc queries) 0 September 25th 07 07:10 PM
Excel 2007 - The connection for this PivotTable has been deleted Michael Excel Discussion (Misc queries) 1 June 22nd 06 08:54 PM
Can't get connection string right Frank Isaacs Excel Programming 1 October 2nd 03 05:02 AM
Can't get connection string right Brad Wood[_2_] Excel Programming 0 September 30th 03 09:38 PM
What is the connection string ? Jan Karel Pieterse Excel Programming 0 July 25th 03 11:37 AM


All times are GMT +1. The time now is 12:53 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"