Updating text objects on the form that opened the current form

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 ============
 
A

Alex Dybenko

Hi,
when you open Match form - you can pass it a reference of calling TourChart3
form, and then on it's close event call FillTextFields3(rstTemp2,
frmCalling)

frmCalling could be declared as public var at Match form's class module

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 
G

Guest

Alex I still pretty new at Access and VBA. I'm not using my open form module
but I would like to. I don't understand how to pass parameters from one form
to another. I'm still tring to grap this area. This is how I open Match
Detail

Private Sub Match17b_Click()
Dim MatchNumber As Integer
MatchNumber = 17
DoCmd.OpenForm "MatchDetail", , , "TourID = " & Me.TourID & _
"AND SectionID = " & Me.SectionID & _
"AND MatchNum = " & MatchNumber, acFormEdit
End Sub
 
A

Alex Dybenko

Hi,

if you declare frmCalling at MatchDetail form's class module as:

public frmCalling as form

then you can set it as:

DoCmd.OpenForm "MatchDetail", , , "TourID = " & Me.TourID & _
"AND SectionID = " & Me.SectionID & _
"AND MatchNum = " & MatchNumber, acFormEdit

set forms("MatchDetail").frmCalling=me

and then use it in this form


--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top