Skip to content

DataSource

Thomas Möller edited this page Apr 12, 2024 · 9 revisions

Class name

DataSource

Purpose / Description

This class contains methods and properties related to the data source for the chart.

Methods

Properties


Detailed description

The following sections contain a detailed description of the methods and properties.

DataFieldNames

Description:

In this property you pass the name(s) of the field(s) that contains the data to be displayed.

  • If you pass one fieldname one dataset is generated.
  • If you pass an array of fieldnames multiple datasets are generated.

Default value:

--

Sample code:

myChart.Chart.DataSource.DataFieldNames = "Dataset1"
'or
myChart.Chart.DataSource.DataFieldNames = Array("Dataset1", "Dataset2", "Dataset3")

Related to:

LabelFieldName, ObjectName, Recordset, SQLStatement

Init

Description:

Calling this method, you can init the data source with some optional parameters.

Parameters

  • DataSourceType :: Type of data source
  • DataSource :: Data source object
  • DataFieldNames :: List of fieldnames containing the data
  • LabelFieldName :: Fieldname containing the label information

Default value:

--

Sample code:

myChart.Chart.DataSource.Init (dstTableName, "tbl_DemoData")

Related to:


LabelFieldName

Description:

In this property you pass the name of the field that contains the labels of the data to be displayed.

Default value:

--

Sample code:

myChart.Chart.DataSource.LabelFieldName = "DataLabel"

Related to:

DataFieldNames, ObjectName, Recordset, SQLStatement

ObjectName

Description:

With this property you pass the name of an object that contains the data to be displayed in the chart.

You can transfer the name of a table or a query as the DataSourceObject.

Default value:

--

Sample code:

myChart.Chart.DataSource.ObjectName = "tbl_DemoData"

or

myChart.Chart.DataSource.ObjectName = "qry_DemoData"

Related to:

DataFieldNames, LabelFieldName, Recordset, SQLStatement

Recordset

Description:

With this property you pass an open recordset that contains the data to be displayed in the chart.

Recordsets of the type dao and adodb are accepted.

Default value:

--

Sample code:

Set rst = CurrentDb.OpenRecordset("Select * from tbl_DemoData order by pkid desc")
Set myChart.Chart.DataSource.Recordset = rst

Related to:

DataFieldNames, LabelFieldName, ObjectName, SQLStatement

SQLStatement

Description:

With this property you pass a sql statement that delivers the data to be displayed in the chart.

Default value:

--

Sample code:

myChart.Chart.DataSource.SQLStatement = "Select * from tbl_DemoData order by pkid desc"

Related to:

DataFieldNames, LabelFieldName, ObjectName, Recordset