Dear All,
I have a form "frmDevtargets" with a subform "frmTask". These forms are based on "tblDevTargets" and "tblTask" respectively. Before opening the form I create a backup copy of each table so if the user chooses not to save their changes I can restore the previous data from the backup tables.
When the user closes the form via a command button and chooses not to save their changes I close "frmDevTargets", delete the contents of "tblDevTargets" and "tbltask" using an SQL statement and import the previous data from the backup tables using another SQL statement.
However, I get an error message saying that the record has been deleted, which is an error code 3167. I have attached code to the On Error property of each form so can see that I'm getting an error code of 0 from "frmTask" when the form is closed, but the Record Is Deleted message appears in addition to this.
When I exit the form normally without deleting the contents of "tblDevTargets" I don't get any error messages. When I delete the contents of "tblDevTargets" from a button on my main menu form I also don't get any error messages.
Can someone please help as I've tried everything I can think of to get rid of, or at least trap, this error.
Thanks
Ben Cooper
I have a form "frmDevtargets" with a subform "frmTask". These forms are based on "tblDevTargets" and "tblTask" respectively. Before opening the form I create a backup copy of each table so if the user chooses not to save their changes I can restore the previous data from the backup tables.
When the user closes the form via a command button and chooses not to save their changes I close "frmDevTargets", delete the contents of "tblDevTargets" and "tbltask" using an SQL statement and import the previous data from the backup tables using another SQL statement.
However, I get an error message saying that the record has been deleted, which is an error code 3167. I have attached code to the On Error property of each form so can see that I'm getting an error code of 0 from "frmTask" when the form is closed, but the Record Is Deleted message appears in addition to this.
When I exit the form normally without deleting the contents of "tblDevTargets" I don't get any error messages. When I delete the contents of "tblDevTargets" from a button on my main menu form I also don't get any error messages.
Can someone please help as I've tried everything I can think of to get rid of, or at least trap, this error.
Thanks
Ben Cooper