简体   繁体   中英

How to update a procedure in another form's subform?

I have a form (MainForm) with 2 subforms, sfrmA & sfrmB. I need to call a procedure (ProcInB) in sfrmB from sfrmA . None of these work:

Forms!MainForm.sfrmB.Form.ProcInB
Call MainForm.Forms.sfrmB.ProcInB
Forms!MainForm![sfrmB].Form.ProcInB
Call MainForm.Forms.sfrmB.ProcInB
Call Forms.MainForm.ProcInB

I've also tried parentheses, quotes, etc. Nothing seems to work and an exhaustive search hasn't provided this specific situation or solution.

Hope someone has the answer!

Thx!

To call a procedure in a form (or any class) module, you do

Call Form_sfrmB.ProcInB()

Of course ProcInB() must be declared as Public .

Form_<name> is how form class modules are named, you see it in the VBA project explorer.

It doesn't matter if the form is a subform in another form. The syntax variations you tried are for accessing controls on subforms, not functions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM