By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,682 Members | 1,980 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,682 IT Pros & Developers. It's quick & easy.

How to make cmd buttons (undo & clear) work on subforms

imrosie
100+
P: 222
Hello anyone,

Is there someone that has a routine to do this? On the Main form I have cmd buttons that clear and undo..

Specifically the Undo doesn't undo the subforms, just the Main form. I also am not sure how to make my clear button, clear out all controls on all 3 forms.

thanks
Sep 14 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 634
Hello anyone,

Is there someone that has a routine to do this? On the Main form I have cmd buttons that clear and undo..

Specifically the Undo doesn't undo the subforms, just the Main form. I also am not sure how to make my clear button, clear out all controls on all 3 forms.

thanks
Hi imrose

Haven't you posted version of this question on another forum?

However, I don't think you can do what you want because after you change the focus from the subform to the main form (ie. when you click the undo button on the main form) then the subform automatically saves any changes, and is then no longer dirty ??
Any undo on the subform will then cause an error !

FYI
To refer to the subform and its control the syntax is

Me.SubformControlName.Form.Requery (to requery the sub form the main form)

Me.SubformControlName.Form.txtControlName="Some Value" (to set a txtbox value).

HTH


MTB
Sep 14 '07 #2

imrosie
100+
P: 222
Hi imrose

Haven't you posted version of this question on another forum?

However, I don't think you can do what you want because after you change the focus from the subform to the main form (ie. when you click the undo button on the main form) then the subform automatically saves any changes, and is then no longer dirty ??
Any undo on the subform will then cause an error !

FYI
To refer to the subform and its control the syntax is

Me.SubformControlName.Form.Requery (to requery the sub form the main form)

Me.SubformControlName.Form.txtControlName="Some Value" (to set a txtbox value).

HTH


MTB
HIi MikeTHeBike,

Yes this forum, but I phrased the title different. Got no response so I thought my title was confusing. I rephrased. thanks
Rosie
Sep 14 '07 #3

P: 1
ok i know this is an old post but i didnt see proper solution for this issue. i just came across the same problem and looked it up this forum popped up. anyways it took 5 minutes for me to come up with a solution. what i did is in the subform itself i put
Expand|Select|Wrap|Line Numbers
  1. If Me.Dirty = True Then
  2.         If MsgBox("Do you want to Save the record", vbYesNo, "Save") = vbNo Then Me.Undo
  3. End If
in the beforeUpdate event. that works but it would prompt. offcourse you can customize the message instead of do you want to save the record.

let me know if you did find any other way.
May 30 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.