简体   繁体   中英

Access Parent and subform open sequence

I have customized ribbons for each parent form. I need to set subform ribbon to be same with parent form.

I initiate ribbon on each forms and subforms on "Form_Load" routine. Parent form ribbon will be different for different user. I cannot hard code it on form property. On subform, I use Me.Parent.Form.RibbonName to get parent form ribbon name.

Me.Parent.Form.RibbonName is able to return parent form name. But, Subform "Form_Load" is trigged before parent form "Form_Load" is trigged. Me.Parent.Form.RibbonName will return null value.

Will it possible to control the load sequence between parent form and subforms? Parent form need to be loaded before any subforms are loaded.

Thanks.

Yes you can. Set the Subforms holders control source to "" Then in the on load or at some other event of the parent form set the subform control to your subform.

 Me.subFormHolder.SourceObject = "subfrmYourSubformName"

The sequence is three-fold:

  1. Subform loads
  2. Main form loads
  3. Subrom loads

So have code in the subform that disables any code when opened initially. Set a flag. When opened next time, run your code and/or sets your variables.

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