Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21100

[RESOLVED] Subscript Out Of Range error while saving from MSFlexGrid to Access Database.

$
0
0
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.
Attached Images
 

Viewing all articles
Browse latest Browse all 21100

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>