Doug Murphy
dw-murphy at cox.net
Fri Oct 29 18:40:00 CDT 2004
Cancel the request! This apparently is one of those which closes first things, the form or subform. The delete code is run in the main form and the subform is apparently still open when it is run. I can trap the error in the subform and prevent the message. Sorry for the wasted bandwidth. Doug -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Doug Murphy Sent: Friday, October 29, 2004 4:07 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Message on deleting records Hi Folks, I have a data entry form with a subform on it. On new record entry a cancel button is visible so if the user decides to not complete the entry of the new record they can cancel out of it. Since several fields on the form are auto filled and the user may have, entered data, moved onto the subform or whatever, when they hit cancel I run a delete query for the record on the subform and one for the record on the main form using their primary keys. They queries are of the form; "Delete * From tablewhatever where fldID = recordIDFromForm" All this works great except that when the form closes and the queries have run I get an Access message saying "You can not add or change a record because a related record is required in tblLot". The delete queries run and delete their respective records with no problem, but I don't know why I am getting this message. The queries run in the order of child record, parent record. Any thoughts on how to get rid of this message would be appreciated. I have turned warnings off before running the delete queries. Doug -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com