On May 23 2004, 10:12 pm, "rkc" <rk*@yabba.dabba.do.rochester.rr.bomb>
wrote in news:_R******************@twister.nyroc.rr.com:
"Dimitri Furman" <df*****@cloud99.net> wrote in message
news:Xn****************************@127.0.0.1... On May 23 2004, 02:46 pm, "rkc"
<rk*@yabba.dabba.do.rochester.rr.bomb> wrote in
news:mk********************@twister.nyroc.rr.com:
> I always use docmd.close acform, me.name although I think I
> remember reading here that people have had some sort of problems
> using me.name.
>
If you open multiple form instances (Dim f As Form_...) as opposed to
using docmd.openform, then docmd.close may close the wrong form
(IIRC, it will close the first instance).
Right. Makes sense. I believe it was Steve Jorgensen that posted his
method for managing multiple instances of the same form using a
collection object.
A nice trick he posted once (thanks Steve!) is to declare a form variable
in the module of the form that will be opened in multiple instances, and
then set that variable to the instance of the form, so that the form keeps
a reference to itself, thus staying open as long as necessary.
dim f as Form_f
set f = new Form_f
set f.Self = f
where Self is a form variable declared in f's module.
All you need to do to close the instance from code is
Set f.Self = Nothing
--
remove a 9 to reply by email