how to store data from msflexgrid in to database access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JuAn2226
    New Member
    • Mar 2008
    • 27

    how to store data from msflexgrid in to database access

    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
  • Tenneyson
    New Member
    • Apr 2008
    • 17

    #2
    Originally posted by JuAn2226
    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
    hi

    pliz Use CODE tags around your code:
    Code:
    ..code goes here..
    and try to resend your question or better, why not ues datagrid

    Code:
    recordset![Fieldname]=datagrid.columns("columnName")

    Comment

    • CyberSoftHari
      Recognized Expert Contributor
      • Sep 2007
      • 488

      #3
      Originally posted by JuAn2226
      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,

      [CODE=vb]strVariable = msfGrid.TextMat rix(1, 1)[/CODE]
      Point the reason for you code here?

      Comment

      Working...