vba - Calling SubForm routine from another Form -


i have form x contains subform y. there routine defined in y form. need call routine form z (which opens whenever user click on button on subform y) on closing event of form z. form x open. have tried till not working:

// in form z

call forms("x").someroutine call forms("y").someroutine 

but every time getting runtime error 2450 access can't find form.

my x form includes subform control named child1. y form contained subform in child1.

form y includes public vba procedure:

public sub someroutine()     debug.print "this someroutine in form " & me.name end sub 

with parent form (x) open in form view, can go immediate window (ctrl+g) , call someroutine ...

forms!x!child1.form.someroutine someroutine in form y 

the key point used name of subform control contains y subform. (notice letter y not present in forms!x!child1.form.someroutine)

the subform control name may same name of form contains ... not have same. check yours ensure use name of control.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -