[AccessD] Setting objects to nothing

Hale, Jim Jim.Hale at FleetPride.com
Wed Oct 5 15:42:14 CDT 2005


Here is the bottom part of the function. BTW if I change "For x = 1 To y" to
"For x = 1 To 14" Excel seems to go away. Strange
Jim Hale

If blState = True Then .ActiveWorkbook.SaveAs FileName:=strFileSave

.ActiveWorkbook.Close SaveChanges:=False
End With
 If blState = False Then GoTo Err_Load_Financials
If Err.Number <> 0 Then
    Load_Financials = False
Else
    Load_Financials = True
 End If
fm.lblFilename.Visible = False

The_End:
    Set fm = Nothing
    For x = 1 To 14 'y
        If Not (rs(x) Is Nothing) Then rs(x).Close: Set rs(x) = Nothing
    Next x
    
    If Not (dbs2 Is Nothing) Then dbs2.Close: Set dbs2 = Nothing
    Set Wsheet = Nothing
    appExcel.Quit
    Set appExcel = Nothing
     If Excel_is_running = True Then MsgBox "Excel still running"
    
DoCmd.Hourglass False
Exit Function

Err_Load_Financials:
    Load_Financials = False
    If Not Err.Description = "" Then MsgBox Err.Description
    Resume The_End
End Function

-----Original Message-----
From: Heenan, Lambert [mailto:Lambert.Heenan at aig.com]
Sent: Wednesday, October 05, 2005 3:09 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Setting objects to nothing


What's the code for setting the Excel instance, and the code you are using
to close it?

Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Hale, Jim
Sent: Wednesday, October 05, 2005 3:56 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Setting objects to nothing


I have a function that can use up to 14 recordsets but may use as few as
three depending upon which case is selected.So I typically go 
   For x = 1 To y
        If Not (rs(x) Is Nothing) Then rs(x).Close: Set rs(x) = Nothing
   Next x
where y is the number of recordsets I actually opened. The problem is I have
an Excel instance that refuses to die and the only thing I can figure is
some dimensioned objects I never use still exist. Jim Hale
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.


More information about the AccessD mailing list