Hi all.

I have a problem in retrieve data from database column and display the data in msflexgrid.
The attached code below can only display the first row data in recordset.
Can anyone here help me to fix this problem?

Thanks in advance.

VB Code:
  1. Private Sub FG_ShowRecordset(myFG As MSFlexGrid, myRST As ADODB.Recordset)
  2.   Dim iField As Integer, iNofFields As Integer
  3.   Dim lRow As Long
  4.  
  5.   Screen.MousePointer = vbHourglass
  6.  
  7.   myFG.Redraw = False
  8.   myFG.AllowUserResizing = flexResizeColumns
  9.   myFG.ScrollTrack = True
  10.  
  11. 'column header
  12. myFG.TextMatrix(0, 0) = "DocNo"
  13. myFG.TextMatrix(0, 1) = "ItemNo"
  14. myFG.TextMatrix(0, 2) = "Item"
  15. myFG.TextMatrix(0, 3) = "Occurances"
  16.  
  17.  
  18. With myRST
  19.     'loop for displaying the document id in DocNo column
  20.     'fields(0) = Id
  21.     For x = 1 To myFG.Rows - 1
  22.         myFG.TextMatrix(x, 0) = .Fields(0).Value
  23.         .MoveNext
  24.         x = x + 1
  25.     Next
  26. End With
  27.  
  28. myFG.Redraw = True
  29.  
  30.  Screen.MousePointer = vbNormal
  31.  
  32.   End Sub