Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Location
    Peterborough, UK
    Posts
    2

    Unanswered: Multi Copies Of Same Form?

    I have a client that wishes to open the same form multiple times, for instance, they may be looking at a clients details and then take a call from another client (So the frmClient wants to be open twice) I know how to do this by coding the form name change into the open command, but when the actual name of the form changes, the sub-forms cannot use the correct ref field as they still look for the original form.

    I've tried letting the user open several copies of the database on the one PC, but when 3 or 4 users each have 2 or 3 copies open. The system gets very slow.

    Any ideas?

  2. #2
    Join Date
    Nov 2001
    Posts
    336
    Here is an example of form class module, which allows to open multiple instances of another form:
    Click on cmdView opens another copy of form frmViewEnrForm, which displays info on user whose ID specified in textbox txtEnrollmentID.


    HTH



    Option Compare Database
    Option Explicit
    ' this is a form class module

    Public colForms As Collection
    Public bytFormsCount As Byte

    Private Sub cmdClose_Click()
    ' On Error Resume Next
    DoCmd.Close
    End Sub

    Private Sub cmdView_Click()

    Dim frmView As Form

    ' E-form
    For Each frmView In colForms
    If frmView.tag = "E_" & Me.txtEnrollmentID Then
    frmView.SetFocus
    Exit Sub
    End If
    Next

    Set frmView = New Form_frmViewEnrForm
    frmView.tag = "E_" & Me.txtEnrollmentID

    ' invoke here any code
    ' to display specific data on the form.
    ' for example,
    ' frmView.DisplayData Me.txtEnrollmentID

    bytFormsCount = bytFormsCount + 1
    colForms.Add frmView, frmView.hWnd & ""
    frmView.Visible = True

    End Sub

    Private Sub Form_Close()
    DoCmd.Quit
    End Sub

    Private Sub Form_Load()

    Set colForms = New Collection
    bytFormsCount = 0

    End Sub

    Private Sub Form_Unload(Cancel As Integer)

    Dim frmView As Form

    If MsgBox("Quit?", vbCritical + vbYesNo, "Attention") = vbYes Then
    For Each frmView In colForms
    frmView.SetFocus
    DoCmd.Close
    Next
    bytFormsCount = 0
    Else
    Cancel = True
    End If

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •