VB Code:
Dim firstDate As Date
Dim lastDate As Date
myChart.Row = 1
firstDate = myChart.RowLabel
myChart.Row = myChart.RowCount
lastDate = myChart.RowLabel
'Get and print history
cnnCon.Open dataText
rsRes.Open "SELECT Date, Result, SampleComments.Comment " & _
"FROM SampleResults, SampleComments " & _
"WHERE SampleResults.ID = SampleComments.ID " & _
"AND SampleResults.TestName = " & Chr(34) & _
cboTest.Text & Chr(34) & _
" AND Date >= " & firstDate & _
" AND Date <= " & lastDate & _
" ORDER BY Date", _
cnnCon, _
adOpenKeyset, _
adLockReadOnly, _
adCmdText
With rsRes
If (Not (.BOF And .EOF)) Then
.MoveFirst
While (Not .EOF)
Printer.Print "Date: " & .Fields("Date").Value & _
" Result: " & .Fields("Result").Value & vbTab & _
" Comment: " & .Fields("Comment").Value
.MoveNext
Wend
End If
End With
rsRes.Close
cnnCon.Close