Charlotte Foust
cfoust at infostatsystems.com
Mon May 1 15:12:07 CDT 2006
OK, I reread your post and I think I see where we crossed purposed. The BeforeDelConfirm event fires after the record is "deleted" to the buffer, which is too late for what you want to do. What you can do is disable the AllowDeletions property of the form and provide a Delete command button. When the user selects a row and then clicks the command button, the record has not yet been deleted, and you can grab the information. Charlotte Foust -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kevin Bachmeier Sent: Monday, May 01, 2006 11:31 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Audit trail of Deleted record. Thanks Jim and Charlotte for your response. Jim, I would use a status field rather than actually deleting if I had that control - that's not the case in my circumstances. Charlotte - I am trying to create the custom pop up, and I do have the 'record changes' option set, but referencing the value of the fields on the record is showing me that the current value is 'null' (via debug from immediate window). Is the 'record changes' option something I can control in code to ensure that it is set before opening this form? This is Access 2000 btw. Thank you. Kevin -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust Sent: Monday, May 01, 2006 1:08 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Audit trail of Deleted record. Assuming you're confirming the deletion before it happens (you are, aren't you?) you can simply use the confirmation routine to write a record to the table. We save the record's primary key (up to 3 separate fields) and the table name in a DeletedRecords table, which uses a system identifier and a long integer as its primary key. Once the user has pressed Del, the BeforeDelConfirm event fires, which happens before any delete confirm dialog is displayed (as long as you have the Record Changes checkbox set under Tools-->Options-->Edit/Find-->Confirm). BeforeDelConfirm still has access to the data which has been written to the buffer and removed from the active record. You could use this event to pop up your own custom confirmation dialog as well. Charlotte Foust -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kevin Bachmeier Sent: Monday, May 01, 2006 10:27 AM To: accessd at databaseadvisors.com Subject: [AccessD] Audit trail of Deleted record. I am trying to find a means of auditing the deletion of records from a table (write a record in another table with the appropriate details of who, when, and key fields of the record being deleted). My attempt at using the BeforeDelConfirm event fails as the values of the form's fields of this bound form are already null (deleted). I was able to find some discussion of auditing changes to records in the archive, but am not able to find anything on deleted records. Anyone with some experience or suggestions on obtaining the values of a record once the user has selected the record and pressed Del, or selected Record Delete? Thank you in advance. Kevin -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com