hello,i have a database.mdb and i want all the fields of the database to be showed in the datagrid.i have an adodb connection and i do not want to use a flexgrid.how can i do this?

Private Sub Form_Load()
    Dim sDate As Date
    Dim eDate As Date    
               
    sDate = #6/15/2009 6:00:00 PM#
    eDate = #6/15/2009 8:00:00 PM#  
    createDummyBase sDate, eDate, 20, "P1--01"      
  
End Sub

all the code is in the createDummyBase.
the connection,the recordsets and the database are in the createDummyBase.
the datagrid is in the form load.

Public Sub createDummyBase(ByVal sDate As Date, ByVal eDate As Date, ByVal period As Integer, ByVal nodeId As String)
    Dim cn As adodb.Connection 'opc
    Dim rs As adodb.Recordset
    Dim sqlstr As String
    Dim dbFilename As String
    Dim orig_path, new_path As String
    Dim RunDate As Date
    Dim delDate As Date
    Dim DataGrid As DataGrid
    Dim rs1 As adodb.Recordset
    dbFilename = "Report_" & Format(Now, "MM_YY") & ".mdb"
    If Dir(App.Path & "\data\Report_" & Format(Now, "MM_YY") & ".mdb") <> "" Then
       Else
        orig_path = App.Path & "\data\Report_mm_yy.mdb"
        new_path = App.Path & "\data\Report_" & Format(Now, "MM_YY") & ".mdb"
        FileCopy orig_path, new_path
    End If
    Set cn = New adodb.Connection
    cn.ConnectionString = BuildConnectionString(dbFilename)
    Set rs = New adodb.Recordset
    cn.Open
    rs.LockType = adLockOptimistic
    Set rs.ActiveConnection = cn
    rs.CursorType = adOpenKeyset
    rs.LockType = adLockOptimistic
    rs.Open "Report", cn
    RunDate = sDate
    Do
            rs.AddNew
            rs!RecDate = RunDate
            rs!nodeId = nodeId
            rs!BatteryVoltage = findLastValue(RunDate, "BatteryVoltage", nodeId)
            rs!i1 = findLastValue(RunDate, "I1", nodeId)
            rs!i2 = findLastValue(RunDate, "I2", nodeId)
            rs!I3 = findLastValue(RunDate, "I3", nodeId)
            rs!MotorRun = findLastValue(RunDate, "MotorRun", nodeId)
            rs!PowerFactor = findLastValue(RunDate, "PowerFactor", nodeId)
           
            rs!WaterLevelOK = findLastValue(RunDate, "WaterLevelOK", nodeId)
     
        RunDate = RunDate + TimeSerial(0, period, 0)       

    Loop Until RunDate > eDate + TimeSerial(0, 0, 1) 
    rs.Update          
    cn.Close
End Sub

the report is the table of the database which has been created.
the fields of the report i want to show them in the datagrid after their creation. any ideas ?please help.. thx

Something from a very long time ago. Will help you though to populate your grid with search functions included. See attachment.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.