Here is the Code.
Private Sub ShowDetail()
Dim strBrcode As String, strVouno As String
Dim strSQL As String
Dim i As Integer
i = 1
FG1.Clear
Call CreateFlexGrid
strBrcode = dcomBranch.BoundText
strVouno = vouno.Text
If RsDet.State = 1 Then
RsDet.Close
End If
strSQL = "SELECT * from cash_dt "
strSQL = strSQL & " WHERE cash_dt.br_code = '" & strBrcode & "' and cash_dt.vouno = '" & strVouno & "' "
RsDet.Open strSQL, sDBconn, adOpenStatic, adLockOptimistic
If Not RsDet.EOF Then
'Load the Grid with details
RsDet.MoveFirst
Do Until RsDet.EOF
With FG1
FG1.AddItem (FG1.Rows + 1)
Call FindNames
If False Then
'To Load the Delete Picture
FG1.Row = i
FG1.Col = 0
Set .CellPicture = LoadPicture(App.Path & "\BMP\DELETE.BMP")
.CellPictureAlignment = flexAlignCenterCenter
End If
.TextMatrix(i, 1) = sPCcode
.TextMatrix(i, 2) = sPCname
.TextMatrix(i, 3) = sAcccode
.TextMatrix(i, 4) = sAccname
.TextMatrix(i, 5) = sSLcode
.TextMatrix(i, 6) = sSLname
.TextMatrix(i, 7) = sCCcode
.TextMatrix(i, 8) = sCCname
.TextMatrix(i, 9) = sBRcode
.TextMatrix(i, 10) = sBrname
.TextMatrix(i, 11) = sPRcode
.TextMatrix(i, 12) = sPRname
.TextMatrix(i, 13) = IIf(IsNull(RsDet!ref_no), vbNullString, RsDet!ref_no)
'.TextMatrix(i, 14) = IIf(IsNull(RsDet!lot_no), vbNullString, RsDet!lot_no)
'.TextMatrix(i, 15) = IIf(IsNull(RsDet!pr_no), vbNullString, RsDet!pr_no)
.TextMatrix(i, 16) = sNarr
.TextMatrix(i, 17) = Format(dDebit, "###,###,###,##0.00")
.TextMatrix(i, 18) = Format(dCredit, "###,###,###,##0.00")
.TextMatrix(i, 19) = sGlnature
End With
i = i + 1
RsDet.MoveNext
Loop
End If
End Sub