Cancel or undo mainform and subform

Thinh

Registered User.
Local time
Today, 13:02
Joined
Dec 20, 2006
Messages
114
I have a mainform and a subform. they are linked by an autonumber that are generated from the mainform. I have setup one to many relationship. one on the main form and many on the subform. I used the Autonumber generated from the main form. i utilized the Openform, acformadd to create a new record.everything is smooth until the user wants to cancel or undo the creation of a new records. The problem i face is when the information is fill in the main form and then move to the subform it gets save so when i do undo on the mainform or the other way around when user switch from main to sub and back to main again nothing happends with the undo. Another issue i face in some instance i can undo the mainform but there are some left over record in the subform. I know there is an option in the relationship i can utilized cascading delete but i am not to fond of it. I need some advice on how the best practise would look like.

my currently code is to much complexed that i some times dont even understand it myself.

I have a delete query that execute when the user cancel the creation of a new record. the criteria is the hidden autogenerated field.
It works somewhat but the code is not clean i feel like there most be a better approach to this problem as this is very common problem.

thanks in advance
 
Cascade delete is extremely useful functionality in the right situation. Why would you want to write the code and queries to delete the child records when the database engine will do it for you?

Your undo button on the main form can delete the record which will also delete the subform records if you have established referential integrity and cascade delete. Don't forget to add edits to the button click event to make sure they really want to delete the current record.
 
does undo counts as a deletation

I dont know if this is a silly question but does undo counts as a deletation.
if that the case then i just use cascading delete if that how it works.
 

Users who are viewing this thread

Back
Top Bottom