SetPenDataArray Method Example

The following is an example on how to pass in arrays of user defined data to create a static Pen in a Chart.

Dim iWrkSpace As Workspace

Dim db_var_name As Database

Dim record_var As Recordset

Dim iCount As Integer

Dim dVal As Variant

Dim dtDate As Variant

Dim lQual As Variant

Dim iResult As Integer

Set iWrkSpace = CreateWorkspace("", "admin", "", dbUseJet)

Set db_var_name = iWrkSpace.OpenDatabase("Chart.mdb")

Set record_var = db_var_name.OpenRecordSet("Data Query", dbOpenDynaset)

record_var.MoveLast

iCount = record_var.RecordCount

record_var.MoveFirst

Dim iRow As Integer

Dim iCol As Integer

Dim Value(500) As Double

Dim Times(500) As Date

Dim Quality(500) As Long

Dim i As Integer

For i = 0 To iCount - 1

Value(i) = record_var.Fields("Value").Value

Times(i) = record_var.Fields("Time").Value

Quality(i) = record_var.Fields("Quality").Value

'Quality(i) should be set to 192 (good data quality) in order to show data

record_var.MoveNext

Next i

db_var_name.Close

dVal = Value

dtDate = Times

lQual = Quality

Call Pen1.SetPenDataArray(iCount, dVal, dtDate, lQual)