jadams0173
Technical User
- Feb 18, 2005
- 1,210
I have a MSFLEXGRID on a form. When the form loads I populate the FlexGrid. I also have a cmd button to let the user add a row. All is well except if the is no data to put in the flexgrid. The only row there is the fixed row with the column headings. Now when I push the button to add a row so i can input some data I get a sub script out of range. Can someone help me out? Here is the code
Subscript out of range occurs on the red line. I am trying to set a field in the new row to 0. Again, if the grid has data in it then this works. The error only accurs when the grid is empty. TIA
Code:
Private Sub cmdAddPart_Click()
Debug.Print frmDetails.MSFlexParts.Rows
frmDetails.MSFlexParts.Rows = frmDetails.MSFlexParts.Rows + 1
[red]frmDetails.MSFlexParts.TextMatrix(frmDetails.MSFlexParts.Row + 1, 1) = 0[/red]
If frmDetails.MSFlexParts.Rows > 13 Then
frmDetails.MSFlexParts.ScrollBars = flexScrollBarVertical
frmDetails.MSFlexParts.Width = 5005
Else
frmDetails.MSFlexParts.ScrollBars = flexScrollBarNone
frmDetails.MSFlexParts.Width = 4775
End If
End Sub