View Full Version : Can you Undo selective fields in subform?


WebFaktor
03-14-2002, 06:51 AM
I've got a main/sub form established with 1 parent-child field established where by their relationship is maintained.

Before tabbing from the mainform (part A) to sub form (part B)I have a beforeupdate code/event established telling users that by proceeding to part B they must save their part A responses and asking if they are sure they want to proceed. . . I've done the same for the subform, i.e., before they enter a new record set they are are advised similiarly per the beforeupdate function.

Problem: If a user proceeds to part B and decides then to cancel out of the form, the Me.Undo code/event does not save the child field whereby that subform info is related to the already saved parent info in part A. Thus, my reports do not properly represent the information saved in part A because they require the child field info in part B.

Can I selectively undo certain fields in a subform and thereby save the child field info when a user cancels out of the form like I've described above?

Thank you in advance,

Michael

DBL
03-14-2002, 07:11 AM
How about forcing a save command at some points, maybe as they exit one of the subform fields?

WebFaktor
03-14-2002, 07:36 AM
If I forced a save I think the problem would be that it would activate the before update code that I have in the subform. Is there any way I can override that code say when The user moves from form A to form B and are then asked do you want to save part A info - does code exist that would allow me to save part A and Part B while over riding part B's before update event?

Good suggestion - thanks

Rich
03-14-2002, 07:52 AM
If your users do not save the subform record then you will have orphaned Parent records. The only way to undo them is to delete the parent or prevent the Undo of the child. You should also be aware that the Parent record is saved as soon as you start entering data in the subform.
HTH

WebFaktor
03-14-2002, 08:19 AM
Rich,

Would you mind advising me (perhaps providing me sample code, Please - oh please - oh please. . .) on how to selectively prevent undo of only the child field in the subform? Doing that would be best for my circumstance.

Thanks - M.