How do I call a subroutine on another form?

GeoMetry

New member
Local time
Today, 13:48
Joined
Jul 24, 2007
Messages
9
My users create/edit records with several types of related data for example Points of Contact (POC) so the edit screen has a button that calls a dialog box that allows them to add one or more POCs to the record. What I would like to do is when they click the close button in the dialog box it will actually just set the visible property to False then when they hit the save button for the entire record I would like to call the save code on the POC form to save the POC data. How do I call a subroutine on another form?
 
Syntax is simply...
Code:
FormObject.Subroutine <parameter>, <parameter>, ...
You can get a form object in a bunch of ways. Commonly...
Code:
Forms!SomeForm
Which fails if the form is not open.
If you must have access to a form, even if it's closed, you can expose it as a property like...
Code:
Property Get fAlways as Form_SomeForm
  if not currentproject.allforms("SomeForm").isloaded then
    docmd.openform "SomeForm"
  end if
  set fAlways = forms!SomeForm
End Property
 

Users who are viewing this thread

Back
Top Bottom