hi,I got few question here. Hope some one can me. plz help me i running out of time
1. how to make my msflexgrid to display data for every 5 min(especially the
number car and average speed.
2. Can the data from msflexgrid store in the database if yes how?
Private Sub Form_Load()
FillFlex
End Sub
Private Sub FillFlex()
On Error Resume Next
Dim lAvg As Long, iCOunt As Integer
Dim intTime As Date
strSql = "SELECT CarID, TimeIn, TimeOut, TimeDuration, Speed" & _
" FROM Car_Details"
iCOunt = 0
FlxRs.Open strSql, DE.Conn, adOpenForwardOn ly, adLockReadOnly
Flex.Rows = 1
If FlxRs.RecordCou nt > 0 Then
For i = 1 To FlxRs.RecordCou nt
Flex.Rows = Flex.Rows + 1
Flex.TextMatrix (i, 0) = FlxRs(0)
Flex.TextMatrix (i, 1) = FlxRs(1)
Flex.TextMatrix (i, 2) = FlxRs(2)
Flex.TextMatrix (i, 3) = FlxRs(3)
If FlxRs(2).Value <> "" Then
iCOunt = iCOunt + 1
End If
Flex.TextMatrix (i, 4) = FlxRs(4)
FlxRs.MoveNext
lAvg = lAvg + Flex.TextMatrix (i, 4) '= FlxRs(3)
lAvg = Math.Round(lAvg , 2)
Next i
lblNum.Caption = iCOunt
lblAverage.Capt ion = lAvg / lblNum
lblAverage.Capt ion = Math.Round(lblA verage.Caption, 2)
Else
lblNum.Caption = ""
End If
FlxRs.Close
End Sub
1. how to make my msflexgrid to display data for every 5 min(especially the
number car and average speed.
2. Can the data from msflexgrid store in the database if yes how?
Private Sub Form_Load()
FillFlex
End Sub
Private Sub FillFlex()
On Error Resume Next
Dim lAvg As Long, iCOunt As Integer
Dim intTime As Date
strSql = "SELECT CarID, TimeIn, TimeOut, TimeDuration, Speed" & _
" FROM Car_Details"
iCOunt = 0
FlxRs.Open strSql, DE.Conn, adOpenForwardOn ly, adLockReadOnly
Flex.Rows = 1
If FlxRs.RecordCou nt > 0 Then
For i = 1 To FlxRs.RecordCou nt
Flex.Rows = Flex.Rows + 1
Flex.TextMatrix (i, 0) = FlxRs(0)
Flex.TextMatrix (i, 1) = FlxRs(1)
Flex.TextMatrix (i, 2) = FlxRs(2)
Flex.TextMatrix (i, 3) = FlxRs(3)
If FlxRs(2).Value <> "" Then
iCOunt = iCOunt + 1
End If
Flex.TextMatrix (i, 4) = FlxRs(4)
FlxRs.MoveNext
lAvg = lAvg + Flex.TextMatrix (i, 4) '= FlxRs(3)
lAvg = Math.Round(lAvg , 2)
Next i
lblNum.Caption = iCOunt
lblAverage.Capt ion = lAvg / lblNum
lblAverage.Capt ion = Math.Round(lblA verage.Caption, 2)
Else
lblNum.Caption = ""
End If
FlxRs.Close
End Sub
Comment