Upper Limit for Recordsets?

JHSam

Board Regular
Joined
Feb 17, 2002
Messages
62
I have encountered an overrun problem working with an Access recordset in an Excel VBA program (I'm using ADO). The recordset is large (1,000,000 values) but the Loop that I use to run through the recordset can't get much past 32,700 values (I get a Run-time error "6": Overflow). Am I approaching one of the upper limits of the recordset (I haven't found any documentation for this)? I am creating the recordset from a SQL string, which works OK within Access. Here's the code string that loads the recorsdet:

rst.Open "SELECT (Table).(Field) FROM (Table);", cn, adOpenForwardOnly, adLockReadOnly, adCmdUnknown

Any suggestions would be appreciated.

Thanks.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
I have encountered an overrun problem working with an Access recordset in an Excel VBA program (I'm using ADO). The recordset is large (1,000,000 values) but the Loop that I use to run through the recordset can't get much past 32,700 values (I get a Run-time error "6": Overflow). Am I approaching one of the upper limits of the recordset (I haven't found any documentation for this)? I am creating the recordset from a SQL string, which works OK within Access. Here's the code string that loads the recorsdet:

rst.Open "SELECT (Table).(Field) FROM (Table);", cn, adOpenForwardOnly, adLockReadOnly, adCmdUnknown

Any suggestions would be appreciated.

Thanks.

Hi,

According to the MSDN CD there is no limit to the numbers of records you can store in an ADO recordset - it's just limited by your hardware capabilities. I think your problem is because the variable you're using to loop through the recordset has been defined as Integer. Integer can only store numbers up to 32,767. Define the variable as Long (maximum value of 2,147,483,647) and the problem should disappear.

If this doesn't work then it may be worth posting your full code.

Regards,
Dan
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,039
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top