How to handle "Not enough storage"-error?

Jaymond Flurrie

Well-known Member
Joined
Sep 22, 2008
Messages
921
Office Version
  1. 365
Platform
  1. Windows
I'm trying to perform an SQL-query (AdoDB recordset) which would assign 30 columns x 108 000 rows of data into a variant. I get "Not enough storage is available to complete this operation"-error. I have 4 GB of RAM in my computer, running 32-bit version of Office 2010 in Windows 7 Professional and I run basically nothing on my computer at the same time. Shouldn't that be enough memory to handle like 3 million elements - even if one element would take couple of hundred kilobytes? And that's not even the case here, I have 29 of those columns full of ones and zeros, so pretty much only a bitmap.

How do I create more memory for Excel to use?


edit. Here's the AdoDB part of my code:
Code:
    'Määritetään lähde
    strProv = "Provider=Microsoft.ace.oledb.12.0;"
    strDataSrc = "Data Source=" & strFullOstoAineistoFile & ";"
    strSrcTable = "FROM [Ostoaineisto$] "
    strXPro = "extended properties=excel 12.0"
    
    Application.StatusBar = "Haetaan ostoaineistoa"
    
    'Create the connection string
    strConnect = strProv & strDataSrc & strXPro
    
    strSelect = "SELECT * "
    
    strSQL = strSelect & strSrcTable
    
    Set rsData = New ADODB.Recordset
    rsData.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly, adCmdText
    
    'Check to make sure we received data
    If Not rsData.EOF Then
        vOstoAineisto = rsData.GetRows(rsData.RecordCount) 'TransposeArray(rsData.GetRows(rsData.RecordCount))
    End If
    
    'Clean up our recordset object.
    rsData.Close
    Set rsData = Nothing


One way to solve this would be if I could create somehow a string that is 600 000 characters long and use that in SQL "IN"-operation. Is Excel VBA ok with 600 000 character strings?
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
If no-one comes up with a solution which will allow you to store your entire recordset in memory, maybe you could consider whether that's really necessary.

Why do you need the entire recordset in memory at the same time?
 
Upvote 0

Forum statistics

Threads
1,224,558
Messages
6,179,512
Members
452,921
Latest member
BBQKING

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