I'm very, very close to success, but...
What I see now is the FlexGrid header (in gray)-
ITEM ON-OFF DATE/TIME
Followed by a row of Yellow cells.
Then another row of Yellow cells with the first row of data with the correct data/time (7:52:13).
This if followed by all the correct yellow and white rows and correct data, just one row off.
What this amounts to is the correct background color (the first two rows should be yellow) but with data skipping the first row and starting on the second row.
I've debugged, stopping at .Row = r with the following:
IntCount = 73
RecInfo!RecordCount = 72
msFlexGrid1.Row = 1
msFlexGrid1.Rows = 2
RecInfo!PLCDATETIME = 1/30/2009 7:52:13 AM.
I've tried various values of .Rows = but nothing works. I can't get msFlexGrid1.Rows to start at row 1.
Here's the code:
Private Sub Class_Click()
Dim strSql As String
strSql = "SELECT * FROM Seagate7" 'WHERE ((recInfo!PLCVALUE)=1)"
recInf

pen strSql, Cn
Dim str() As String
Dim onoff As String
Dim onoffstate As String
Dim r As Integer
Dim c As Integer
Dim bgcolour As Long
With MSFlexGrid1
.RowHeight(1) = 290
.Redraw = False
.Clear
.Rows = 2
.Cols = 3
.ColWidth(0) = .Width / 2.3
.ColWidth(1) = .Width / 6.1
.ColWidth(2) = .Width / 3.1
.FormatString = "ITEM" & vbTab & " ON-OFF" & vbTab & " DATE/TIME"
For r = 1 To recInfo.RecordCount
.Row = r
str = Split((recInfo!plcitem) & "", ".")
onoff = (recInfo!plcvalue)
bgcolour = IIf(recInfo!plcvalue = 1, vbYellow, vbWhite)
For c = 0 To .Cols - 1
.Col = c
.CellBackColor = bgcolour
Next c
If onoff = "1" Then
onoffstate = " ON"
Else: onoffstate = " OFF"
End If
.AddItem str(1) & " " & str(2) & vbTab & onoffstate & " " & _
vbTab & (recInfo!plcdatetime) ' & ""
recInfo.MoveNext
Next r
.Redraw = True
End With
recInfo.Close
End Sub
I've read the manual on msFlexGrid, but I still can't get it though my thick head how to move the data up to the correct row.
Thanks,
Gary