[AccessD] Multi Forms

jwcolby jwcolby at colbyconsulting.com
Thu Jul 8 13:24:29 CDT 2004


Actual working code.  The key is that opening a form this way only keeps it
open as long as a pointer to the form remains in existence.  Thus you have
to save the pointer in a collection to hold it open.  The CLOSE of the form
MUST remove itself from the collection or the user will be able to close the
form but a pointer to it will remain, clogging up the works.

I use a string in the caption as the key to the collection, thus the form
can look in it's caption to find the key to its pointer in the collection.

Option Compare Database
Option Explicit

Private colForms As Collection
Private blnFrmsInit As Boolean

Function MyFormOpen(strFrmName As String, strInstanceName As String)
Dim frm As Form
    
    If blnFrmsInit = False Then
        Set colForms = New Collection
        blnFrmsInit = True
    End If
    Set frm = New Form_lfrmSpecialtyPreferences
    frm.Caption = strInstanceName
    colForms.Add frm, strInstanceName
End Function

Function MyFormClose(strInstanceName As String)
    colForms.Remove strInstanceName
End Function

Hope this helps.

John W. Colby 
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Francisco H Tapia
Sent: Thursday, July 08, 2004 1:19 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Multi Forms


Yup, but in my app, i'm going to have to open several instances of the 
several forms, I don't want to write up this funciton for every one of 
them...

Charlotte Foust wrote On 7/7/2004 4:00 PM:

>Are you trying to open multiple instances of the same form, or what?
>
>Charlotte Foust
>
>-----Original Message-----
>From: Francisco H Tapia [mailto:my.lists at verizon.net]
>Sent: Wednesday, July 07, 2004 1:38 PM
>To: AccessD
>Subject: [AccessD] Multi Forms
>
>
>http://members.iinet.net.au/~allenbrowne/ser-35.html
>
>I'd like to make this code more re-useable but i seem to be stuck at
>this line
>
>I thought I'd be able to pass a variable and then just set the new
>object as a new "form" object.  Is this not possible?
>
>    Set frm = New Form_frmClient
>
>
>wasn't there a thread not too long ago about multiforms?
>
>  
>


-- 
-Francisco


-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com






More information about the AccessD mailing list