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

Charlotte Foust cfoust at infostatsystems.com
Mon Jul 25 10:44:13 CDT 2005


In order to set frm = Forms!frmCert, frmCert has to be open.  SWAG:
Unless you close it, the reference to its module (Form_frmCert) probably
won't go completely out of scope, since the object is still open.

Charlotte


-----Original Message-----
From: Hale, Jim [mailto:Jim.Hale at fleetpride.com] 
Sent: Monday, July 25, 2005 8: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