[AccessD] Possible Solution for: RE: Loading more than one instan ce of a form

DWUTKA at marlow.com DWUTKA at marlow.com
Mon Jun 26 10:46:29 CDT 2006


I have a solution for you JC, but it has a limit.  You can only have
multiple instances of one form.  Switch to another, and you lose the first
ones.

Save this as modNewForm.  To use this, set the form you want to open with
SetNewForm.  Then open it with OpenNewForm.

It's no where near a perfect solution, but then again, you are talking about
an Access GUI, which even though it is an awesome RAD environment, it has
it's limitations.

Option Compare Database
Public colForms As New Collection
Public mintI As Integer
Function OpenNewForm()
Dim frm As Form_Form2
Set frm = New Form_Form2
mintI = mintI + 1
colForms.Add Item:=frm, Key:=frm.Hwnd & ""
frm.Caption = "My Form " & mintI
DoCmd.MoveSize (mintI + 1) * 80, (mintI + 1) * 350
frm.Visible = True
End Function
Function SetNewForm(strName As String)
Dim md As Module
Set md = Modules("modNewForm")
md.ReplaceLine 5, "Dim frm as Form_" & strName
md.ReplaceLine 6, "Set frm = New Form_" & strName
Set md = Nothing
End Function

Drew

-----Original Message-----
From: JWColby [mailto:jwcolby at colbyconsulting.com]
Sent: Monday, June 26, 2006 8:31 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Loading more than one instance of a form


>  But there is no way to get around hard coding 'Form_MyForm' in the SET
line other then of course to generate the code on the fly in a module.

Precisely!!! 


John W. Colby
Colby Consulting
www.ColbyConsulting.com





More information about the AccessD mailing list