PDA

View Full Version : Subform record deletion from main form



cath_hopes
04-07-2008, 08:12 AM
Hi there!

I've put together a main form based on a Booking table and this form has a subform based on a Booking Status table. The booking table has a one to many relationship with the Booking Status table.

I've coded a 'Close' button on my main form which asks the user whether they wish to save changes or not. If the answer is 'No' and the main form is a new record then Forms![Booking Form].Undo works fine and removes any new Booking and associated Booking Status records..
My problem occurs when the Booking record is not new on the main form Forms![Booking Form].Undo correctly undoes any changes to the Booking record but how do I delete any new unsaved Booking Status record? Or if the Booking Status record isn't new how do I undo any changes? On the main form code I've tried Me.Booking_Status.Form.Undo and Forms![Booking StatusForm].Undo but it doesn't seem to do anything.

I was thinking that maybe one solution for the delete new record issue could be to add a line of code to the remaining form that the Booking form returns to after closing that says "Delete any Booking Status records where the 'Date last saved' field is blank". But this doesn't solve the undoing of any changes issue.

Any advice/ thoughts gratefully received!

Thanks in advance,
Catherine

Trevor
04-26-2008, 10:34 PM
could you attach your db (with any sencitive info revoved) so that we may see what is going on?