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

Hale, Jim Jim.Hale at FleetPride.com
Mon Jul 25 10:31:41 CDT 2005


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