By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,968 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,968 IT Pros & Developers. It's quick & easy.

how to store data from msflexgrid in to database access

P: 27
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, adOpenForwardOnly, adLockReadOnly
Flex.Rows = 1
If FlxRs.RecordCount > 0 Then

For i = 1 To FlxRs.RecordCount
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.Caption = lAvg / lblNum
lblAverage.Caption = Math.Round(lblAverage.Caption, 2)
Else
lblNum.Caption = ""
End If
FlxRs.Close

End Sub
Apr 19 '08 #1
Share this Question
Share on Google+
2 Replies


Tenneyson
P: 17
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, adOpenForwardOnly, adLockReadOnly
Flex.Rows = 1
If FlxRs.RecordCount > 0 Then

For i = 1 To FlxRs.RecordCount
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.Caption = lAvg / lblNum
lblAverage.Caption = Math.Round(lblAverage.Caption, 2)
Else
lblNum.Caption = ""
End If
FlxRs.Close

End Sub
hi

pliz Use CODE tags around your code:
Expand|Select|Wrap|Line Numbers
  1. ..code goes here..
and try to resend your question or better, why not ues datagrid

Expand|Select|Wrap|Line Numbers
  1. recordset![Fieldname]=datagrid.columns("columnName")
  2.  
Apr 24 '08 #2

Expert 100+
P: 487
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? ...
1. You can use timer control to display data between intervals.
2. Yes,

Expand|Select|Wrap|Line Numbers
  1. strVariable = msfGrid.TextMatrix(1, 1)
Point the reason for you code here?
Apr 24 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.