Marshall Barton said:
elburze said:
Why some times calling subform [or master form] public methods from inside
form works, and other times it gives runtime error 2455 "You entered an
expression that has invalid reference to the Property Form"
Private Sub aMainFormEventProcedure()
Me.subformName.Form.methodNameInSubform
End Sub
The most common reasons for that is when the name of the
subform control is different from the name of the form
object it is displaying. You must use the name of the
subform control.
Another reason is when the method is called before the
subform has completed its opening processing.
Thank you for replying. my procedure is actually:
Private Sub Form_Current()
Me.subformName.Form.methodNameInSubform
End Sub
So; the subform has not opened yet, after form open and Form_Current() is
called. I want methodNameInSubform() to be called when main form [plus its
subforms] have openend; also be called everytime I browse to another record
(click left or right navigation buttons). Is Form_Current() the right event
to code? If so; would this do what I want:
Private Sub Form_Current() 'in main form
If <subforms are open>
Me.subformName.Form.methodNameInSubform
End Sub
Private Sub Form_Open() 'in subform (to run once the first time)
Me.Form.methodNameInSubform
End Sub