I have an MSFlexgrid that displays records based on Names and Dates. I was just wondering if there is anyway the user can view or scroll through each set by alphaetical order. Also, does anyone know how the records in MSFlexgrid are arranged?
here is my code...
Public Function DisplayRSGrid(rs As DAO.Recordset, Grid As MSFlexGrid, Optional Form As Form)
Dim fld As DAO.Field
On Error Resume Next
Screen.MousePointer = vbHourglass
With Grid
.Redraw = True
'Setup the grid
.Cols = rs.Fields.Count
.Rows = 1
.Row = 0
.Col = 0
MSFlexGrid1.ColWidth(0) = 2000
MSFlexGrid1.ColWidth(1) = 2000
MSFlexGrid1.ColWidth(3) = 1000
MSFlexGrid1.ColWidth(4) = 2000
MSFlexGrid1.ColWidth(5) = 600
MSFlexGrid1.ColWidth(6) = 600
MSFlexGrid1.ColWidth(7) = 600
MSFlexGrid1.ColWidth(9) = 600
MSFlexGrid1.ColWidth(12) = 600
MSFlexGrid1.ColWidth(13) = 600
MSFlexGrid1.ColWidth(14) = 800
rs.MoveFirst
'Setup the grid headings
For Each fld In rs.Fields
.Col = fld.OrdinalPosition
.ColWidth(.Col) = Form.TextWidth(String(fld.Size + 9, "a") '.Width/ rs.Fields.Count
.Text = fld.Name
Next fld
'Move through each row in the recordset.
While Not rs.EOF
.Rows = Grid.Rows + 1
.Row = .Rows - 1
'loop through all fields
For Each fld In rs.Fields
.Col = fld.OrdinalPosition
.Text = fld.Value
Next fld
rs.MoveNext
Wend
.Redraw = True
End With
Screen.MousePointer = vbNormal
End Function
here is my code...
Public Function DisplayRSGrid(rs As DAO.Recordset, Grid As MSFlexGrid, Optional Form As Form)
Dim fld As DAO.Field
On Error Resume Next
Screen.MousePointer = vbHourglass
With Grid
.Redraw = True
'Setup the grid
.Cols = rs.Fields.Count
.Rows = 1
.Row = 0
.Col = 0
MSFlexGrid1.ColWidth(0) = 2000
MSFlexGrid1.ColWidth(1) = 2000
MSFlexGrid1.ColWidth(3) = 1000
MSFlexGrid1.ColWidth(4) = 2000
MSFlexGrid1.ColWidth(5) = 600
MSFlexGrid1.ColWidth(6) = 600
MSFlexGrid1.ColWidth(7) = 600
MSFlexGrid1.ColWidth(9) = 600
MSFlexGrid1.ColWidth(12) = 600
MSFlexGrid1.ColWidth(13) = 600
MSFlexGrid1.ColWidth(14) = 800
rs.MoveFirst
'Setup the grid headings
For Each fld In rs.Fields
.Col = fld.OrdinalPosition
.ColWidth(.Col) = Form.TextWidth(String(fld.Size + 9, "a") '.Width/ rs.Fields.Count
.Text = fld.Name
Next fld
'Move through each row in the recordset.
While Not rs.EOF
.Rows = Grid.Rows + 1
.Row = .Rows - 1
'loop through all fields
For Each fld In rs.Fields
.Col = fld.OrdinalPosition
.Text = fld.Value
Next fld
rs.MoveNext
Wend
.Redraw = True
End With
Screen.MousePointer = vbNormal
End Function