The difficult I do immediately, the impossible takes a little bit longer.
Public Function LogDeletion(lngDGAMS As Long, strForm As String, strNotes As String)
Dim strSQL As String
Log Record Deletions...
Private Sub cboActionID _AfterUpdate()
Dim intResp As Integer
intResp = MsgBox("You are about to DELETE this record, are you sure?", vbYesNo + vbExclamation, "Delete")
If intResp = vbYes Then
Call LogDeletion( Me.txtID , " frmYourForm ", "ID Number " & Me.txtID & " has been Deleted!")
Me.cboActionID = ""
Public Function GetUserID() As String
GetUserID = Environ("Username")
3. Select the [Event Procedure] for the AfterUpdate event of a field that will be changed prior to the deletion (it could be a checkbox). In my case it's cboActionID which must be changed to say *(D)elete* or the record will not Delete. (Pay attention to the * BLUE * fields as those are to be changed to reflect the names of fields on your form!)
While I tend to use Allen Browne's Audit Trail for most databases, sometimes I come across a situation where I need something a little different. This is for those situations...
1. Create tblLog...
Can be either TEXT or NUMERIC depending on the Data Type of the ID's you want to store.
2. Go the Forms VB Editor in which the RecordSource contains the records you want to log if they are deleted and copy/paste the below into the VB Editor. (Pay attention to the * BLUE * fields as those are to be changed to reflect the names of fields on your form!)