Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Is there a way to release the memory taken by a Recordset Object ?

Hello,

Is there a way to release the memory taken by a Recordset Object or a
Connection ?

Because everytime I run the code below it takes about 2 mb of my ram.

Public Sub Simulation3()

strPathExcelFile_FILTER = ThisWorkbook.FullName

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")

objConnection.Open = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathExcelFile_FILTER & ";" & _
"Extended Properties=Excel 8.0;"

objRecordSet.Open "SELECT COUNT(*) AS resultat FROM [SHEET1$A1:IV20]
WHERE [PX_LAST] 20", objConnection, adOpenForwardOnly, adLockReadOnly

Simulation.Label2.Caption = objRecordSet.fields("resultat")

objRecordSet.Close
objConnection.Close
Set objConnection = Nothing
Set objRecordSet = Nothing

End Sub


Thanks in advance.

Regards,





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Is there a way to release the memory taken by a Recordset Object

Nader,

Check here for suggested workarounds:

http://support.microsoft.com/kb/319998




--
Hope that helps.

Vergel Adriano


"Nader" wrote:

Hello,

Is there a way to release the memory taken by a Recordset Object or a
Connection ?

Because everytime I run the code below it takes about 2 mb of my ram.

Public Sub Simulation3()

strPathExcelFile_FILTER = ThisWorkbook.FullName

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")

objConnection.Open = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathExcelFile_FILTER & ";" & _
"Extended Properties=Excel 8.0;"

objRecordSet.Open "SELECT COUNT(*) AS resultat FROM [SHEET1$A1:IV20]
WHERE [PX_LAST] 20", objConnection, adOpenForwardOnly, adLockReadOnly

Simulation.Label2.Caption = objRecordSet.fields("resultat")

objRecordSet.Close
objConnection.Close
Set objConnection = Nothing
Set objRecordSet = Nothing

End Sub


Thanks in advance.

Regards,






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Release Memory Jeff Excel Discussion (Misc queries) 1 September 25th 06 09:28 PM
Unable to release Excel COM object Avadhoot Excel Programming 1 August 28th 06 02:20 PM
how do i release memory kurb Excel Programming 1 February 15th 05 04:31 AM
Type Statements and Memory Release Neil Miller[_4_] Excel Programming 5 November 3rd 04 02:12 AM
Release files from memory?? Ron[_21_] Excel Programming 3 March 5th 04 12:49 PM


All times are GMT +1. The time now is 02:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"