Results 1 to 2 of 2

Thread: Getting Access column names into FlexGrid

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    10
    Hi,

    I'm using the following code to populate a FlexGrid with info from an Access DB Table. How can I adapt or supplement the code so that the column names from the Db table are also displayed.
    I need to be able to get the column headings at run time as the info being displayed will be different each time and will also be obtained from different tables each time.

    Any suggestions would be greatfully appreciated,
    cheers,
    shovels



    Here's the code I'm using:-

    mfgFlex.Clear
    k = rs.RecordCount
    j = rs.Fields.Count
    mfgFlex.Rows = k + 1
    mfgFlex.Cols = j + 1

    With mfgFlex

    lngRow = 1
    Do Until rs.EOF
    For lngCol = 0 To rs.Fields.Count - 1
    'MsgBox rs.Fields.Item(lngCol)
    .TextMatrix(lngRow, lngCol + 1) = rs(lngCol)
    Next lngCol
    rs.MoveNext
    lngRow = lngRow + 1
    Loop
    End With

  2. #2
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284
    This is the code I use to put in the field names as column headings


    .........
    Dim SColName As String
    Dim iCol As Integer
    ...
    ...
    ...
    With rs
    grdData.Cols = .Fields.Count
    grdData.Row = 0
    For iCol = 0 To .Fields.Count - 1
    SColName = .Fields(iCol).Name
    grdData.Col = iCol
    grdData.Text = SColName
    Next
    End With
    ...
    ...

    Where rs is a recordset passed to the module byRef and grdData is my flexigrid passed to the module also byRef

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width