How do you filter based on category?

J

Jim Hubbard

I'm using an ado recordset for the data source for an OWC10 Chart
control. I can see the FilterAxis (containing the 'category' column
and all other columns for the recordset) but how do I filter the
category?

I also need to filter the columns and only show certain user-selected
columns. Any ideas on how this can be done?
 
M

michael weiss

I don't know if this will help, but from the OWCVBA10.chm
files...
This example removes the ShipVia field from the filter
axis in PivotTable1.
PivotTable1.ActiveView.FilterAxis.RemoveFieldSet "ShipVia"

Maybe you can use something like this?
hth,
Michael
 
J

Jim Hubbard

When I tried this, all I keep getting is a "Subscript out of range" error.

This shouldn't be that hard...then again.....
 
T

Thao Moua [ms]

This is what you need to filter the fields.

'assume Company contains "IBM, MAC, MSFT, APPLE"
sFieldName = "Company"
Set objPFS =
ChartSpace1.InternalPivotTable.ActiveView.FieldSets
(sFieldName)
Set objPC = ChartSpace1.InternalPivotTable.Constants

'This is like Unchecking the "All" item
objPFS.AllIncludeExclude = objPC.plAllExclude
' This is like Checking the "All" item
objPFS.AllIncludeExclude = objPC.plAllInclude

' At this point it is a matter of setting the
PivotField.IncludedMembers and PivotField.Excluded
members to be what you want to be checked
' We will use the InvcludedMembers property.
Set objPF = objPFS.Fields(sFieldName)
objPF.IncludedMembers = Array("msft","apple")

Thao Moua
OWC Webchart Support
 

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

Top