[AccessD] Dim fm as form or fm as Form_ rmCert

John W. Colby jwcolby at colbyconsulting.com
Mon Jul 25 15:58:55 CDT 2005


I cannot say what exactly is going on, but I can say that...

>I've learned the hard way that whenever I open an instance of Excel EVERY
object variable must be set to nothing because Access cannot be relied upon
to cleanup properly.

No, you need to clean up EVERY object variable regardless of the object
type.  Access' garbage collection is not reliable and you will end up with
all kinds of weird symptoms if you don't clean up behind yourself.

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Hale, Jim
Sent: Monday, July 25, 2005 11:32 AM
To: 'Accessd (E-mail)
Subject: [AccessD] Dim fm as form or fm as Form_ rmCert


In a module I referenced an open form as follows:

dim fm as Form_frmCert 
Set fm = Forms!frmCert
....do stuff using txt values on the form
run Excel, place the text values in ranges on a worksheet
etc
	If Not (wb Is Nothing) Then Set wb = Nothing
    	If Not (fm Is Nothing) Then Set fm = Nothing
	appExcel.Quit
    	Set appExcel = Nothing

When the function finished an instance of Excel was still running.when I
changed the dim statement to read
	dim fm as form
the instance of Excel terminated properly. I've learned the hard way that
whenever I open an instance of Excel EVERY object variable must be set to
nothing because Access cannot be relied upon to cleanup properly. However,
I'm curious what is going on here. Why does fm not go out of scope?

Jim Hale

***********************************************************************
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