What am I doing wrong? I ran the same SQL on my Access database and I showed 194 records but when I ran this code in the VB program to populate my MSHFlexGrid only the last 20 or so are showing on the grid. Running the debug, I can see that it is picking up every record up to number 22 and then it abruptly exits the debugger. When the grid flashes back on the screen, the every record except the last 20 or so is showing.
x% = OpenGLedger(rsAny)
rsAny.Open ParmSQL, GLedgerconn, adOpenDynamic, adLockOptimistic
rsAny.MoveFirst
'hfgbud.Row = hfgbud.Rows - 1
AddGridRow
Do While Not rsAny.EOF
For I = 4 To hfgbud.Rows - 1 'Starts at line 4
strData(0) = rsAny!FullAccount
strData(1) = rsAny!Description
strData(2) = rsAny!Total
strData(3) = rsAny!Amount01
strData(4) = rsAny!Amount02
strData(5) = rsAny!Amount03
strData(6) = rsAny!Amount04
strData(7) = rsAny!Amount05
strData(8) = rsAny!Amount06
strData(9) = rsAny!Amount07
strData(10) = rsAny!Amount08
strData(11) = rsAny!Amount09
strData(12) = rsAny!Amount10
strData(13) = rsAny!Amount11
strData(14) = rsAny!Amount12
For J = 0 To hfgbud.Cols - 1
hfgbud.TextMatrix(I, J) = strData(J)
Next
rsAny.MoveNext
If rsAny.EOF Then
Exit Sub
End If
Next
AddGridRow
Loop
rsAny.Close
errhand:
MsgBox "Error: " & Err.Description
x% = OpenGLedger(rsAny)
rsAny.Open ParmSQL, GLedgerconn, adOpenDynamic, adLockOptimistic
rsAny.MoveFirst
'hfgbud.Row = hfgbud.Rows - 1
AddGridRow
Do While Not rsAny.EOF
For I = 4 To hfgbud.Rows - 1 'Starts at line 4
strData(0) = rsAny!FullAccount
strData(1) = rsAny!Description
strData(2) = rsAny!Total
strData(3) = rsAny!Amount01
strData(4) = rsAny!Amount02
strData(5) = rsAny!Amount03
strData(6) = rsAny!Amount04
strData(7) = rsAny!Amount05
strData(8) = rsAny!Amount06
strData(9) = rsAny!Amount07
strData(10) = rsAny!Amount08
strData(11) = rsAny!Amount09
strData(12) = rsAny!Amount10
strData(13) = rsAny!Amount11
strData(14) = rsAny!Amount12
For J = 0 To hfgbud.Cols - 1
hfgbud.TextMatrix(I, J) = strData(J)
Next
rsAny.MoveNext
If rsAny.EOF Then
Exit Sub
End If
Next
AddGridRow
Loop
rsAny.Close
errhand:
MsgBox "Error: " & Err.Description