Can the parent be aware of a change on a subform

Kenln

Registered User.
Local time
Today, 06:36
Joined
Oct 11, 2006
Messages
551
I have a traditional Main-Form sub-Form.

On the Main-Form I have enabled the mouse wheel for scrolling and of course there's the traditional navigation buttons as well as a combobox. All normal ways of moving between records.

However, this time if any data has changed (deleted, added, updated, etc.) on the sub-form I do not want the user to be able to navigate away or to another record without confirmation via a msg box.

So I have two questions.
1) How do I let the parent know the data has somehow changed?
2) How might I prevent the user from navigating to another record?

Any help would be greatly appreciated.

Thank you,
 
I'm not sure if I can. I believe the subform has to update first. Then I need to prevent the user from navigating away.

Here is the larger picture (so to speak). I data in a Master Table. As the user navigates between records a copy of each (individual) project's records are copies to a temporary table.

This allows the user to modify a projects records, change, delete or whatever. Then click a button and the specific project records in the master are deleted and replaced by these new (updated) ones. Yeah!!! By having two seperate tables I can allow the user to say oops and reload the original data and start over.

However... What if they make these changes, forget to click the update (or disregard button) and navigate to another record?

Their changes would not have been uploaded and subsequently lost as new next projects records are copies from the Main Table. Which is why I'm trying to limit them from navigating away without confirmation.

So part of the answer could be, Form.AfterUpdate set something in the parent (???) saying info updated. However what can I set other than a global variable and... does AfterUpdate work for insert, update and (biggy) delete?

As for not navigating, I'm unsure on this one.
 
Disable the main form when the subform is edited using the subform OnChange event. It will stay disabled thereafter even after subform records are updated.

Reenable the main form as part of the Update and Discard botton command procedures.
 

Users who are viewing this thread

Back
Top Bottom