Hello,
I am working on a application where i am using a MSFlexGrid to allow users to populate data.
When the populates the data in the FlexGrid and says "Save", the data in the grid is written to the access database.
In the for loop(which writes data to access), I am getting an error "Subscript out Of Range".
Below is the code that is causing the issues.
==================================================================
For i = 0 To FlxGd.Rows - 1
For j = 0 To FlxGd.Cols - 1
rs.AddNew
rs.Fields(0) = FlxGd.TextMatrix(0, j + 2) ------> This line throws the error.
rs.Fields(1) = FlxGd.TextMatrix(i + 1, 0)
rs.Fields(2) = FlxGd.TextMatrix(i + 1, 1)
rs.Fields(3) = FlxGd.TextMatrix(i + 1, j + 2)
rs.Fields(4) = cmbMonths.Text
Next
Next
==================================================================
Please let me know if there is any issue in the code that might be causing this.
I have also attached a screenshot of my form.
Thanks in advance.
I am working on a application where i am using a MSFlexGrid to allow users to populate data.
When the populates the data in the FlexGrid and says "Save", the data in the grid is written to the access database.
In the for loop(which writes data to access), I am getting an error "Subscript out Of Range".
Below is the code that is causing the issues.
==================================================================
For i = 0 To FlxGd.Rows - 1
For j = 0 To FlxGd.Cols - 1
rs.AddNew
rs.Fields(0) = FlxGd.TextMatrix(0, j + 2) ------> This line throws the error.
rs.Fields(1) = FlxGd.TextMatrix(i + 1, 0)
rs.Fields(2) = FlxGd.TextMatrix(i + 1, 1)
rs.Fields(3) = FlxGd.TextMatrix(i + 1, j + 2)
rs.Fields(4) = cmbMonths.Text
Next
Next
==================================================================
Please let me know if there is any issue in the code that might be causing this.
I have also attached a screenshot of my form.
Thanks in advance.