<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Download PivotTable Parameters</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2005/06/23/download-pivottable-parameters/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2005/06/23/download-pivottable-parameters/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Wed, 08 Feb 2012 23:58:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Christopher</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/06/23/download-pivottable-parameters/#comment-14378</link>
		<dc:creator>Christopher</dc:creator>
		<pubDate>Mon, 27 Jun 2005 23:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1173#comment-14378</guid>
		<description>&lt;p&gt;&lt;i&gt;In my version of Nortwind.mdb both 05022 and 5022 exist in the output of the query Invoices&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;yup - that&#039;s true...apologies for the confusion.&lt;/p&gt;
&lt;p&gt;I should have said:&lt;/p&gt;
&lt;p&gt;pc.CommandText = Replace(pc.CommandText, ìë05022?î, ì?î, , 1) &quot;fails&quot; because the CommandText of the pivot cache contains &#039;5022&#039; in the SQL statement and not &#039;05022&#039;.&lt;/p&gt;
&lt;p&gt;When you open up the file, the selected item in the pivot table is for post code 5022 and not 05022.&lt;/p&gt;
&lt;p&gt;Which is why if &#039;fails silently&#039; - it&#039;s not failing at all...there&#039;s no text to susbsitute! (Don&#039;t you hate it when code does what it should and not what you assume!)&lt;/p&gt;
&lt;p&gt;cheers,&lt;br&gt;
Christopher&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><i>In my version of Nortwind.mdb both 05022 and 5022 exist in the output of the query Invoices</i></p>
<p>yup &#8211; that&#8217;s true&#8230;apologies for the confusion.</p>
<p>I should have said:</p>
<p>pc.CommandText = Replace(pc.CommandText, ìë05022?î, ì?î, , 1) &#8220;fails&#8221; because the CommandText of the pivot cache contains &#8217;5022&#8242; in the SQL statement and not &#8217;05022&#8242;.</p>
<p>When you open up the file, the selected item in the pivot table is for post code 5022 and not 05022.</p>
<p>Which is why if &#8216;fails silently&#8217; &#8211; it&#8217;s not failing at all&#8230;there&#8217;s no text to susbsitute! (Don&#8217;t you hate it when code does what it should and not what you assume!)</p>
<p>cheers,<br />
Christopher</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: XL-Dennis</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/06/23/download-pivottable-parameters/#comment-14370</link>
		<dc:creator>XL-Dennis</dc:creator>
		<pubDate>Mon, 27 Jun 2005 04:06:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1173#comment-14370</guid>
		<description>&lt;p&gt;Christopher, &lt;/p&gt;
&lt;p&gt;In my version of Nortwind.mdb both 05022 and 5022 exist in the output of the query Invoices.&lt;/p&gt;
&lt;p&gt;So the issue still remains.&lt;/p&gt;
&lt;p&gt;(5022 is a numeric value while &#039;05022&#039; is a text value.)&lt;/p&gt;
&lt;p&gt;Oh well, when I got more time I will take a closer look into it as well.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br&gt;
Dennis&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Christopher, </p>
<p>In my version of Nortwind.mdb both 05022 and 5022 exist in the output of the query Invoices.</p>
<p>So the issue still remains.</p>
<p>(5022 is a numeric value while &#8217;05022&#8242; is a text value.)</p>
<p>Oh well, when I got more time I will take a closer look into it as well.</p>
<p>Kind regards,<br />
Dennis</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/06/23/download-pivottable-parameters/#comment-14369</link>
		<dc:creator>Christopher</dc:creator>
		<pubDate>Mon, 27 Jun 2005 01:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1173#comment-14369</guid>
		<description>&lt;p&gt;OK, promted by Dennis&#039;s work, and investigating further:&lt;/p&gt;
&lt;p&gt;pc.CommandText = Replace(pc.CommandText, ìë05022?î, ì?î, , 1) fails because their is no &#039;05022&#039; in the customers table.&lt;/p&gt;
&lt;p&gt;There is a 5022 postal code though.&lt;/p&gt;
&lt;p&gt;changing &quot;&#039;05022&#039;&quot; to &quot;5022? - and the code snippet works just fine.&lt;/p&gt;
&lt;p&gt;Of couse, since my knowledge of databases and SQL is almost non-existant - there could be a reason for the 0-padding of the postal code field... :-)&lt;/p&gt;
&lt;p&gt;(And still curious why it failed silently)&lt;/p&gt;
&lt;p&gt;cheers,&lt;br&gt;
Christopher&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>OK, promted by Dennis&#8217;s work, and investigating further:</p>
<p>pc.CommandText = Replace(pc.CommandText, ìë05022?î, ì?î, , 1) fails because their is no &#8217;05022&#8242; in the customers table.</p>
<p>There is a 5022 postal code though.</p>
<p>changing &#8220;&#8217;05022&#8242;&#8221; to &#8220;5022? &#8211; and the code snippet works just fine.</p>
<p>Of couse, since my knowledge of databases and SQL is almost non-existant &#8211; there could be a reason for the 0-padding of the postal code field&#8230; <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>(And still curious why it failed silently)</p>
<p>cheers,<br />
Christopher</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: XL-Dennis</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/06/23/download-pivottable-parameters/#comment-14337</link>
		<dc:creator>XL-Dennis</dc:creator>
		<pubDate>Sat, 25 Jun 2005 16:52:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1173#comment-14337</guid>
		<description>&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;It seems that the Replace-command does not do the work properly:&lt;/p&gt;
&lt;p&gt;pc.CommandText = Replace(pc.CommandText, &quot;&#039;05022&#039;&quot;, &quot;?&quot;, , 1)&lt;/p&gt;
&lt;p&gt;Gives &quot;&#039;?&#039;&quot; and therefore it&#039;s treated as a string and not as a parameter.&lt;/p&gt;
&lt;p&gt;Running the code gives an empty pivottable.&lt;/p&gt;
&lt;p&gt;This happen for me when running 2003.&lt;/p&gt;
&lt;p&gt;One way to solve it and also take more control of the process itself is to use the following approach:&lt;/p&gt;
&lt;p&gt;Option Explicit&lt;/p&gt;
&lt;p&gt;Sub Test()&lt;br&gt;
Dim ptCache As PivotCache&lt;br&gt;
Dim wsSheet As Worksheet&lt;br&gt;
Dim stSQL As String&lt;/p&gt;
&lt;p&gt;Set wsSheet = ActiveSheet&lt;/p&gt;
&lt;p&gt;With wsSheet&lt;br&gt;
    Set ptCache = .PivotTables(1).PivotCache&lt;br&gt;
End With&lt;/p&gt;
&lt;p&gt;stSQL = &quot;SELECT Orders.Freight, Orders.ShipCountry &quot; &amp; _&lt;br&gt;
        &quot;FROM &#039;C:Northwind&#039;.Orders Orders &quot; &amp; _&lt;br&gt;
        &quot;WHERE (Orders.ShipCountry=?);&quot;&lt;/p&gt;
&lt;p&gt;ptCache.CommandText = stSQL&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;Personally I sometimes prefer to use ADO instead of ODBC but that&#039;s another story.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br&gt;
Dennis&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi all,</p>
<p>It seems that the Replace-command does not do the work properly:</p>
<p>pc.CommandText = Replace(pc.CommandText, &#8220;&#8217;05022&#8242;&#8221;, &#8220;?&#8221;, , 1)</p>
<p>Gives &#8220;&#8216;?&#8217;&#8221; and therefore it&#8217;s treated as a string and not as a parameter.</p>
<p>Running the code gives an empty pivottable.</p>
<p>This happen for me when running 2003.</p>
<p>One way to solve it and also take more control of the process itself is to use the following approach:</p>
<p>Option Explicit</p>
<p>Sub Test()<br />
Dim ptCache As PivotCache<br />
Dim wsSheet As Worksheet<br />
Dim stSQL As String</p>
<p>Set wsSheet = ActiveSheet</p>
<p>With wsSheet<br />
    Set ptCache = .PivotTables(1).PivotCache<br />
End With</p>
<p>stSQL = &#8220;SELECT Orders.Freight, Orders.ShipCountry &#8221; &amp; _<br />
        &#8220;FROM &#8216;C:Northwind&#8217;.Orders Orders &#8221; &amp; _<br />
        &#8220;WHERE (Orders.ShipCountry=?);&#8221;</p>
<p>ptCache.CommandText = stSQL</p>
<p>End Sub</p>
<p>Personally I sometimes prefer to use ADO instead of ODBC but that&#8217;s another story.</p>
<p>Kind regards,<br />
Dennis</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/06/23/download-pivottable-parameters/#comment-14299</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Fri, 24 Jun 2005 13:29:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1173#comment-14299</guid>
		<description>&lt;p&gt;Link is fixed.&lt;/p&gt;
&lt;p&gt;I did it in Excel 2000, but will check it out in 2003 to see if I get the same results.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Link is fixed.</p>
<p>I did it in Excel 2000, but will check it out in 2003 to see if I get the same results.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: H.G. Lamy</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/06/23/download-pivottable-parameters/#comment-14297</link>
		<dc:creator>H.G. Lamy</dc:creator>
		<pubDate>Fri, 24 Jun 2005 11:52:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1173#comment-14297</guid>
		<description>&lt;p&gt;PivotTableParameters.zip&lt;/p&gt;
&lt;p&gt;This link doesn&#039;t work. Can you repair it ?&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;H.G. Lamy&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>PivotTableParameters.zip</p>
<p>This link doesn&#8217;t work. Can you repair it ?</p>
<p>Thank you,</p>
<p>H.G. Lamy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/06/23/download-pivottable-parameters/#comment-14287</link>
		<dc:creator>Christopher</dc:creator>
		<pubDate>Fri, 24 Jun 2005 05:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1173#comment-14287</guid>
		<description>&lt;p&gt;Interesting, with Excel 2003, the macro fails silently. When I attempt to put the parameter in via MS Query, I get the response &quot;Parameters are not allowed for this query&quot;&lt;/p&gt;
&lt;p&gt;(And the path to Northwind has been adjusted)&lt;/p&gt;
&lt;p&gt;cheers,&lt;br&gt;
Christopher&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Interesting, with Excel 2003, the macro fails silently. When I attempt to put the parameter in via MS Query, I get the response &#8220;Parameters are not allowed for this query&#8221;</p>
<p>(And the path to Northwind has been adjusted)</p>
<p>cheers,<br />
Christopher</p>
]]></content:encoded>
	</item>
</channel>
</rss>

