A.D.TEJPAL
adtp at airtelbroadband.in
Tue May 2 09:21:40 CDT 2006
Kevin, Form's Delete event occurs before its BeforeDelConfirm event. Both can be cancelled if desired. At Delete event stage, the record under deletion is still the current one and correct values for various controls are returned. By the time you encounter BeforeDelConfirm event, the record next to that meant for deletion becomes the current record and the values returned become misleading. For your case, Delete event should be the one to use. Best wishes, A.D.Tejpal --------------- ----- Original Message ----- From: Charlotte Foust To: Access Developers discussion and problem solving Sent: Tuesday, May 02, 2006 01:42 Subject: Re: [AccessD] Audit trail of Deleted record. 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