[AccessD] Multi-Instance Forms re-visited

Ken Ismert KIsmert at TexasSystems.com
Wed Dec 15 19:37:59 CST 2004


Francisco,

>You definately should provide hWnd as a long
>and also should declare colForm as WithEvents.
>
>Michael R. Mattys

To expand on what Micheal said about WithEvents, you will need some way to
remove the colForm object reference you have stored in your MultiForms
collection when the form closes.

As you know a form created using the Set colForm = New Form_FormModule
syntax will live as long as the colForm reference is in scope. This means
that when the user closes that form, it will never be truly closed until
colForm is set to Nothing.

So, the easiest way to shutdown properly is to trap the Form_Close event:

Private WithEvents colForm As Access.Form

' This assumes that MultiForms is your
' public clsMultiInstance instance, and
' that colhWnd is your key to the
' Form collection
Private Sub colFrm_Close()
    MultiForms.Remove colhWnd
End Sub

-Ken





More information about the AccessD mailing list