This topic is locked

Before Record Deleted

5/29/2008 1:56:05 PM
ASPRunnerPro General questions
T
Tim author

Hello,
I'm trying to "intercept" a record deletion on a table and log the attempt instead. Here is what I've done:
On the "choose fields" page, I added three fields to the list page - Deleted, DeletedOn, DeletedBy (these are fields in the table I am working on).

Then in the visual editor I remove these colums (so as not to confuse the user)

Then on the events tab in list page/before record deleted I added this code:
dict("Deleted") = "1"

dict("DeletedOn") = Now()

dict("DeletedBy") = Session("UserID")
BeforeDelete = False
On the list page, when I select a record and click "delete selected" I get no errors, the record isn't deleted (which is good), but the 3 fields are not updated.
Can I not do this on a list page? Do I need an SQL update statement? If so, how would I set the "where" statement to update only selected rows?
Thanks,

Tim

J
Jane 5/30/2008

Tim
to update record in the Before record deleted event use this code:

strDelete = "update TableName set Deleted=1, DeletedOn=Now(), DeletedBy='" & Session("UserID") & "' where " & where

dbConnection.Execute strDelete
BeforeDelete = False