Unanswered: urgent: how to pass args to mult instance form
Need help fast!...
How can I pass the equivalent of an OpenArgs value to a multiple-instance form when adding it to a collection?
Here is the code used to add the form to the collection (to create the newest instance of the form):
Private mcolContactDetailForms As New Collection
Private Sub Combo0_AfterUpdate()
Dim frmDet As Access.Form
Static d As Long
d = d + 1
Set frmDet = New Form_frmContactDetails
.Caption = "Contact Details " & d
.Visible = True
.Filter = "pkautContactID = " & Me.Combo0
.FilterOn = True
.Tag = "Forms!frmContactLookup!Combo0|Det"
mcolNewContactForms.Add frmDet, frmDet.Caption
I'm no expert on this procedure...it was adapted from an ACCESS ADVISOR article (www.msaccessadvisor.com, "Create Multiple Copies of a Form").
What I need to do is have the value that I put in the Tag used in the Open event of the form. However, none of the properties set here are put into effect on the form until after it is Opened, Loaded, Activated, etc. And you can't set the OpenArgs value here because it is read-only.
So, how can I pass a string to the new form for use on its Open event?
I have a form that I use for several purposes (rather than having numerous copies of the same form). Certain controls are visible/not visible depending upon the calling form (or more precisely, the purpose of the call). The form is not simply opened, a new instance of the form is spawned. So, I would like to pass info to the form when it is spawned so that it can set the appropriate properties.
For similar forms that do not require multiple instances, I simply pass the info in OpenArgs and process the OpenArgs on the form Open event. How can I perform a similar action on a form that is spawned as a new instance in a collection?
Pushing or pulling the info after the form is opened is not so great...because I am not setting control values, but rather properties of the form. So the user would see the form open with a header and footer (for example), then load a record, then see the header and footer disappear.
I could use global variables, but I thought there might be a more direct method of passing the info (specifically, a string).
if your code to do the pulling is in the forms load event then the user will not see anything except that which you want. IE perform you set in the forms on load event
you can reference any public variables and controls from another form
so you cna determine the version of the form you want to show based on a setting within the calling from, and populate the called form as required