Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 15,089 times

Downloads

Related Categories

Multi Instance Forms

domdm

This code will show you how to use forms in multi instances, meaning you can create many instances of a control at runtime but yet only need create the form once at design. To use this code you need:

2 Forms: - frmLaunch and frmMain
1 command Button on frmlaunch: - cmdNew
1 lable on frmMain: - lblNum

Paste the following code into frmLaunch:

Option Explicit
'//Define Variables for the form
Dim NewPage() As New frmMain

'//Define Variables for the Number of forms that have been opened
Public Pages As Integer

Private Sub cmdNew_Click()
    'add one to the number of forms
    Pages = Pages + 1
    ReDim Preserve NewPage(Pages)
    'set the new forms page number
    NewPage(Pages).lblNum.Caption = Pages
    'open a new page
    NewPage(Pages).Show
    'redimensionise the new page array
    ReDim NewPage(Pages + 1) As New frmMain
End Sub

Comments

  • VBA Data - APPEND

    Posted by PellaCAD on 21 Apr 2005

    How can I make the follwoing code APPEND to an existing file??

    Private Sub CommandButton14_Click()
    'Sub TextStreamTest()
    Const ForReading = 1, ForWriting = 2, ForAppending = 3
    Const Tr...

  • VBA - Appending Data - HOW???

    Posted by PellaCAD on 21 Apr 2005

    How can I make the follwoing code APPEND to an existing file??

    Private Sub CommandButton14_Click()
    'Sub TextStreamTest()
    Const ForReading = 1, ForWriting = 2, ForAppending = 3
    Const Tris...

  • work in vba?

    Posted by paulj on 21 Apr 2005

    Trying to get this to work in vba in ms access 2003. Keep getting a "Member already exists in an object module from which this object module derives."

    Option Compare Database
    Option Explicit
    '//...

  • Posted by domdm on 13 Jul 2002

    Well what it is is a peice of code for creating multi instances of a form at runtime, this means that you create the form once in design view (therefore code it once) but at runtime you can call the f...

  • Wow

    Posted by KevCarlucci on 13 Jul 2002

    Lifechanging, earthshattering, groundbreaking, dozey-doeing, people-in-grass-houses-shouldn't-stow-thronesing, nutcracking, chicken-winging, monkey-nutting, enlightening, shiver-to-the-spining, other-...