This function is used to fill the Ms Flex grid dynamically.Just copy this code and place in your mo
This function is used to fill the Ms Flex grid dynamically.Just copy this code and place in your modules.Call that function in your VBForm.
API Declarations
Option Compare Text
Rate This function is used to fill the Ms Flex grid dynamically.Just copy this code and place in your mo
(1(1 Vote))
Public Function FillGrid(pGrid As MSFlexGrid, Sql As String) As Boolean
Dim llngCount1 As Long
Dim llngCount2 As Long
Dim rs As New ADODB.Recordset
On Error GoTo ErrHndFillGrid
rs.Open Sql, conlocal, adOpenKeyset, adLockReadOnly
If rs.RecordCount <> 0 Then
rs.MoveLast
rs.MoveFirst
pGrid.Cols = rs.Fields.Count + 1
For llngCount1 = 0 To rs.Fields.Count - 1
pGrid.Row = 0
pGrid.Col = llngCount1 + 1
pGrid.Text = rs.Fields(llngCount1).Name
Next llngCount1
pGrid.Rows = rs.RecordCount + 1
For llngCount1 = 0 To rs.RecordCount - 1
pGrid.Row = llngCount1 + 1
pGrid.Col = 0
pGrid.Text = llngCount1 + 1
For llngCount2 = 0 To rs.Fields.Count - 1
pGrid.Col = llngCount2 + 1
If rs(llngCount2).Type = adDate Then
pGrid.Text = Format(rs(llngCount2), "dd-mmm-yyyy")
Else
pGrid.Text = Trim(rs(llngCount2)) & ""
End If
Next llngCount2
rs.MoveNext
Next llngCount1
FillGrid = True
Else
FillGrid = False
End If
rs.Close
Set rs = Nothing
Exit Function
ErrHndFillGrid:
FillGrid = False
End Function
This function is used to fill the Ms Flex grid dynamically.Just copy this code and place in your mo Comments
No comments yet — be the first to post one!
Post a Comment