Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subscript out of range err when referencing GetRows variant

Status
Not open for further replies.

xtreme1

Programmer
May 27, 2000
51
US
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I'm attempting to pull one row from a select query using the GetRows method of the Recordset object, and throw it into a variable array.&nbsp;&nbsp;For some reason, when I try to reference the array I get a &quot;Subscript out of range&quot; error.&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I understand what this error is all about, but I'm not really sure why it's occuring.&nbsp;&nbsp;I checked the upper boundaries using:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ubound(recordarray,2) + 1 'Returns 42(good)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ubound(recordarray,1) + 1 'Returns -1(?)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>Both Lbounds return 0, I didn't change the lower boundary so that's normal.&nbsp;&nbsp;I guess I'm just hoping someone has run into this problem before and will recognize the mistake I'm making.&nbsp;&nbsp;Thanks for any help in advance. <p>xtreme1<br><a href=mailto:rbio@excite.com>rbio@excite.com</a><br><a href= > </a><br>
 
Why in the world are you using an Array.<br>A recordset is a far more flexible &quot;Array&quot; <br>Which has unbounded range, it has built in Sorting, Searching and anyhing you can dream of.<br><br>Access is all about recordsets. So think of your array as an Access Table and use the the power or SQL to manipulate it.<br><br>Write your write your data into a table in stead of an Array and it will open a whole host of functions.<br><br>&nbsp;<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I am using tables for my info, but basically what I'm trying to achieve here is a &quot;cut and paste append&quot; of a record.&nbsp;&nbsp;What I want to be able to do is use &quot;rstname.GetRows&quot; to pull all of the info into an array temporarily, then use &quot;rstname.AddNew&quot; to add the new record to the end of the table.&nbsp;&nbsp;Once I do that I can pull all the info back from the array and put it in its rightful place again.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Basically the reason I'm using the array is because of the &quot;Error&quot; that can be found in memo fields when two users change data at the same time.&nbsp;&nbsp;This doesn't happen often, but when it does it causes problems elsewhere in the database.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Until we can completely eliminate this problem, I need to be able to fix it quickly and preferably automatically.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top