Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running subform procedure from parent form? 1

Status
Not open for further replies.

paulminne

Programmer
Nov 27, 2002
80
AU
Hi,

I have a parent form with a subform included on it. I want to have an undo button on the parent form which will undo all the changes to both the parent and subforms. I have got it working fine for the parent form but not for the subform.

Firstly, does anyone have any suggestions how this can be achieved for the subform?

And secondly, can I simply include a button on the subform which is an undo button, and just call the "OnClick" event procedure from the parent form when another button is pressed?

Regards,

- Paul
 
if the code in the undo botton is simply
me.undo
then add
Me.subformname.Form.Undo

 
Hi,

This doesnt seem to work. I think it is because when you take the focus away from the subform and back to the parent form, it saves the changes automatically. And therefore prevents you from being able to undo.

Thanks for you help,

- Paul
 
try Me.subformcontrolname.Form.btnUndo_Click
i did not test the code so i dont know preventing the undo but just to call the sub it works make sure that that it is not Private


Me.Parent.controlname_Click
will work to call a sub in the parent
 
To call a vb function that's in a subform, just make sure that function is declared as "public" instead of the default "private", then you can use a command similiar to described above:

Forms![FormName].Function()

This can also be used to run a function that's located within any open form, doesn't necessarily have to be a subform.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top