The form displayed in a Subform Control is not Open, and therefore not in
the Forms collection. It exists and is addressable as the .Form property of
the Subform Control.
This code in "frmOrders"
Private Sub Command10_Click()
Me!sbfCustomers.Form.RunFromOutside
End Sub
caused the following code in the Form ("frmCustomers" but name is
immaterial) embedded in the Subform Control ("sbfCustomers") to execute.
This is a form-level procedure -- you may have to change your event
procedure from Private to Public.
Public Sub RunFromOutside()
MsgBox "The code in frmCustomers ran", vbOKOnly, "Test running code
from outside"
End Sub
Good luck with your project.
Larry Linson
Microsoft Access MVP
"Richard Hollenbeck" <ri****************@verizon.net> wrote in message
news:NmU4d.12229$464.9727@trnddc01...
I have a form that was a stand-alone form which I converted into a
sub-form. On the original form was a close button which did a lot more than just
close. It ran update and append queries (after a VBYesNo in a MsgBox) on
the data in what is now the sub-form. Then it closed. It also runs
functions local to that sub-form. I'd like to just keep everything the
way it is and somehow just call the code from the parent form's new close
button. Here's what I already tried:
"Forms!subFrmEnterGrades!cmdSave_Click"
But I got an error. Access couldn't find the form, though it was right
there in the main form! I was looking right at it. Is there another way
to skin this cat, or do I have to start from scratch?