I found this code example for working with the data source control. It uses Northwind.MDB
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>DSC Example Page</title>
<link rel="STYLESHEET" href="../Styles/OWCStyle.css" type="text/css">
<!-- DataSoure Control -->
<object classid="clsid:0002E530-0000-0000-C000-000000000046" id="DSC">
</object>
</head>
<body>
<h1>DSC Example Page</h1>
<p>Show only the following countries: <input type="text" id="txtCountries"
size="40" value="USA, Canada, Mexico"> <input type="button"
value="Go" id="btnFilter"></p>
<!-- Chart Control -->
<object classid="clsid:0002E500-0000-0000-C000-000000000046" id="ChartSpace1"
style="width:100%;height:75%" width="576" height="384">
</object>
<!-- Script for loading the chart -->
<script language=VBScript>
'--------------------------------------------------------------------------
' Window_onLoad()
'
' Purpose: Runs when the page is first loaded in the browser. Code
' here will set the connection info for the DSC and add a
' RecordsetDef object as a source of data for the Chart.
'
Sub Window_onLoad()
' Set the DSC's ConnectionString property.
' Note: Change this line if you move the MDB file or want to connect to
' a different MDB file.
sDBPath = "..\Data\Northwind.mdb"
DSC.ConnectionString = _
"provider=microsoft.jet.oledb.4.0;data source=" & sDBPath
' Add a RecordsetDef object that will be a
' row source for the Chart control
set rsdef = DSC.RecordsetDefs.AddNew("SELECT Country, " & _
"Shippers.CompanyName AS Shipper, " & _
"Count(*) AS Shipments, " & _
"Sum(Quantity) AS Quantity " & _
"FROM Invoices " & _
"WHERE OrderDate Between #1/1/98# " & _
"and #12/31/98# " & _
"GROUP BY Country, Shippers.CompanyName", _
DSC.Constants.dscCommandText, "ChartData"
' Add a calculated field to the RecordsetDef object
rsdef.PageFields.Add "[Quantity]/[Shipments]", _
DSC.Constants.dscCalculated, "AvgQtyPerShipment"
' Add another RecordsetDef object to show using a named view
' and the ServerFilter proprety
set rsdef = DSC.RecordsetDefs.AddNew("Invoices", _
DSC.Constants.dscView, "ChartData2"
rsdef.ServerFilter = "OrderDate Between #1/1/98# and #1/31/98#"
BindChartToDSC Chartspace1, DSC, "ChartData", "Shipper", _
"Country", "AvgQtyPerShipment"
' Label the value axis of the chart
set c = ChartSpace1.Constants
set ax = ChartSpace1.Charts(0).Axes(c.chAxisPositionBottom)
ax.HasTitle = True
ax.Title.Caption = "Average Quantity per Shipment"
ax.Title.Font.Size = 8
End Sub 'Window_onLoad()
'--------------------------------------------------------------------------
' BindChartToDSC()
'
' Purpose: Binds a chart to a Recordset in the DSC. (This example creates
' a Pie chart.)
' In: cspace reference to the ChartSpace object
' dsc reference to the Data Source control
' sRSName name of RecordsetDef in the DSC to which we will bind
' sSeries name of the result column containing series
' sCategories name of the result column containing categories
' sValues name of the result column containing values
'
Sub BindChartToDSC(cspace, dsc, sRSName, sSeries, sCategories, sValues)
' Local variables
Dim cht ' Chart object we'll create in the chart space
' Grab the Constants object so we can use constant names in the script.
' Note: This is only needed in VBScript. Do not use this in VBA code.
set c = cspace.Constants
' Clear out anything that is in the chart space
cspace.Clear
' First tell the chart that its data is coming from the DSC
set cspace.DataSource = dsc
' Next tell it what Recordset object within the DSC it will bind to
cspace.DataMember = sRSName
' Create a (Pie) chart in the chart space
set cht = cspace.Charts.Add()
cht.HasLegend = True
cht.Type = c.chChartTypeBarClustered
' Now call SetData to bind the various dimensions.
' Second parameter is zero, meaning use the first data source
' if there is more than one
cht.SetData c.chDimSeriesNames, 0, sSeries
cht.SetData c.chDimCategories, 0, sCategories
cht.SetData c.chDimValues, 0, sValues
End Sub 'BindChartToDSC()
'--------------------------------------------------------------------------
' btnFilter Click Event Handler
'
' Purpose: Runs whenever the Filter button is clicked. Gets the Recordset
' object the chart is bound to and filters for only the specified
' countries.
Sub btnFilter_onClick()
' Local variables
Dim rs ' Recordset object
Dim asCountries ' String array of country names
Dim sFilter ' Filter expression
Dim ct ' Counter
' Get the Recordset object the chart is bound to
Set rs = DSC.Execute(ChartSpace1.DataMember)
' Get the set of country names to filter on
asCountries = Split(txtCountries.value,","
' Build the filter expression
on error resume next
sFilter = "Country='" & Trim(asCountries(0)) & "'"
if err.Number = 0 then
For ct = 1 To Ubound(asCountries)
sFilter = sFilter & " OR Country='" & _
Trim(asCountries(ct)) & "'"
Next 'ct
else
sFilter = ""
end if
' Now set the filter expression.
' The chart will automatically update.
rs.Filter = sFilter
End Sub 'btnfilter_onClick()
Sub txtCountries_onKeyDown()
if window.event.keyCode = 13 then ' Enter key
btnFilter_onClick
end if
End Sub
</script>
</body>
</html>