Question : Excel 2003 Pivot Table ODBC MySQL Data Source

Hi there

I have an Excel 2003 file with a Pivot table When adding a certain Field I get the following error message:

 
Pivot Table Error Message
340696
 


After googling arround, I found:
http://books.google.ca/books?id=VnCDbXKjSaYC&pg=PA195&lpg=PA195&dq=a+field+in+your+source+data+has+more+unique+items&source=bl&ots=orYhIUvNtv&sig=hrXKyGZWMB0GpHdTA0b9gy5997c&hl=en&ei=lId0TODtHYL88AbK4rmNBw&sa=X&oi=book_result&ct=result&resnum=3&ved=0CBwQ6AEwAg#v=onepage&q=a%20field%20in%20your%20source%20data%20has%20more%20unique%20items&f=false

The original MySQL query gets data from year 2008 to now and the maximum unique items in the field may have been reached.

Now, I need to change the MySQL query in Excel 2003 so I can limit the query to only get the year 2010 data.

Can you please provide me with detailed instructions, so I can access that MySQL query?


Thanks,
Rene

Answer : Excel 2003 Pivot Table ODBC MySQL Data Source

Ok, let's try this workaround, capturing the working string and do a replace on it

Sub myName()
    Dim pvtTable As PivotTable
    Dim SQLString As String
    Set pvtTable = ActiveSheet.PivotTables(1)
    With pvtTable.PivotCache
       SQLString =   .CommandText    'the SQL Query
       SQLString = Replace(SQLString, "2008-01-01", "2010-01-01")
       .CommandText = SQLString
    End With
End Sub


Random Solutions  
 
programming4us programming4us