G
Guest
I have created a function (Function is below) that can open multiple
instances of the same form and this function is working fine. I created this
new collection to hold the forms:
Public mcolFormInstances As New Collection
Inside the function is this sub: FillTextFields3(rstTemp2, frm) It also is
working fine.
My question is: I open "TourChart3" From this function I then click on a
text object that opens a form Called Match detail to input data which is not
part of mcolFormInstances Collection. Just before this form closes I want to
call FillTextFields3(rstTemp2, frm) and pass the TourChart3 form instance
name.
FillTextFields3 is in a general Module
I could have three or more of TourChart3 open at the same time.
How do I go about this?
======== Function ============
Function OpenFormInstance(FormName As String, _
rstTemp2 As Variant, _
Optional WhereCondition As String)
'Declare the form
Dim frm As Form
'With rstTemp2
Select Case FormName
Case "TourChart1"
Set frm = New Form_TourChart1
Case "TourChart3"
Debug.Print "Form Name -"; FormName
Set frm = New Form_TourChart3
Call FillTextFields3(rstTemp2, frm)
Case "MatchDetail"
Set frm = New Form_MatchDetail
Case Else
Debug.Assert False
End Select
If WhereCondition <> "" Then
frm.Filter = WhereCondition
frm.FilterOn = True
End If
'Call FillTextFields(rstTemp2, frm)
'Make the form visible
frm.Visible = True
'Need to add a reference to the form so that it doesn't
'imediately close when the form variable goes out of scope
mcolFormInstances.Add frm
'End With
End Function
======== End Code that open an instance of the form ============
instances of the same form and this function is working fine. I created this
new collection to hold the forms:
Public mcolFormInstances As New Collection
Inside the function is this sub: FillTextFields3(rstTemp2, frm) It also is
working fine.
My question is: I open "TourChart3" From this function I then click on a
text object that opens a form Called Match detail to input data which is not
part of mcolFormInstances Collection. Just before this form closes I want to
call FillTextFields3(rstTemp2, frm) and pass the TourChart3 form instance
name.
FillTextFields3 is in a general Module
I could have three or more of TourChart3 open at the same time.
How do I go about this?
======== Function ============
Function OpenFormInstance(FormName As String, _
rstTemp2 As Variant, _
Optional WhereCondition As String)
'Declare the form
Dim frm As Form
'With rstTemp2
Select Case FormName
Case "TourChart1"
Set frm = New Form_TourChart1
Case "TourChart3"
Debug.Print "Form Name -"; FormName
Set frm = New Form_TourChart3
Call FillTextFields3(rstTemp2, frm)
Case "MatchDetail"
Set frm = New Form_MatchDetail
Case Else
Debug.Assert False
End Select
If WhereCondition <> "" Then
frm.Filter = WhereCondition
frm.FilterOn = True
End If
'Call FillTextFields(rstTemp2, frm)
'Make the form visible
frm.Visible = True
'Need to add a reference to the form so that it doesn't
'imediately close when the form variable goes out of scope
mcolFormInstances.Add frm
'End With
End Function
======== End Code that open an instance of the form ============