Sub FillGrid(AnyGrid, AnyRS)
Dim i
AnyGrid.Cols = AnyRS.Fields.Count
AnyGrid.Rows = 1
AnyGrid.Row = 0
For i = 0 To AnyRS.Fields.Count - 1
AnyGrid.Col = i
AnyGrid.Text = AnyRS.Fields(i).Name
Next
Do While AnyRS.EOF <> True
AnyGrid.Rows = AnyGrid.Rows + 1
AnyGrid.Row = AnyGrid.Rows - 1
For i = 0 To AnyRS.Fields.Count - 1
AnyGrid.Col = i
AnyGrid.Text = AnyRS.Fields(i)
Next
AnyRS.movenext
Loop
End Sub
|