Allen Browne's Audit Trail Not Working

R

Rene

Good afternoon,

I copied the VBA code and followed each step. However, the following is not
happening:

The data is not transferred from the audit temp table to the audit log table
The data is not copied to the audit temp table when I edit the record (Edit
function is not working at all)

I'm not sure what's going wrong but suspect it may be because of other code
on the form. These are the codes...

This one suppresses the default confirmation box and displays a custom box:

Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
Dim strMessage As String
Dim intResponse As Integer
On Error GoTo ErrorHandler
strMessage = "Would you like to delete this record?"
intResponse = MsgBox(strMessage, vbYesNo + _
vbQuestion, _
" Continue delete?")
If intResponse = vbYes Then
Response = acDataErrContinue
Else
Cancel = True
End If
Exit Sub
ErrorHandler:
MsgBox "Error #: " & Err.Number & vbCrLf & _
vbCrLf & Err.Description
End Sub


This one is attached to the Delete button:

Private Sub cmdDelete_Click()
On Error GoTo cmdDeleteErrorHandler
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.Save acDefault
DoCmd.Close acDefault
DoCmd.OpenForm "frmLookupMeetings"
cmdDeleteExit:
Exit Sub
cmdDeleteErrorHandler:
Resume cmdDeleteExit
End Sub


This one is attached to the Save button:

Private Sub cmdSave_Click()
On Error GoTo cmdSaveErrorHandler
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acDefault
DoCmd.OpenForm "frmLookupMeetings"
cmdSaveExit:
Exit Sub
cmdSaveErrorHandler:
MsgBox "Complete required fields before saving this record.", vbOKOnly +
vbInformation, " Missing Data"
DoCmd.GoToControl "cboMeetingTopicID"
Resume cmdSaveExit
End Sub


Do I need to modify any of the above for it to work. If so, how? If not,
what's going wrong?

As always, thanks for your help.

Rene
 
M

Mrs. Lori Andersen

Rene said:
Good afternoon,

I copied the VBA code and followed each step. However, the following is
not
happening:

The data is not transferred from the audit temp table to the audit log
table
The data is not copied to the audit temp table when I edit the record
(Edit
function is not working at all)

I'm not sure what's going wrong but suspect it may be because of other
code
on the form. These are the codes...

This one suppresses the default confirmation box and displays a custom
box:

Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
Dim strMessage As String
Dim intResponse As Integer
On Error GoTo ErrorHandler
strMessage = "Would you like to delete this record?"
intResponse = MsgBox(strMessage, vbYesNo + _
vbQuestion, _
" Continue delete?")
If intResponse = vbYes Then
Response = acDataErrContinue
Else
Cancel = True
End If
Exit Sub
ErrorHandler:
MsgBox "Error #: " & Err.Number & vbCrLf & _
vbCrLf & Err.Description
End Sub


This one is attached to the Delete button:

Private Sub cmdDelete_Click()
On Error GoTo cmdDeleteErrorHandler
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.Save acDefault
DoCmd.Close acDefault
DoCmd.OpenForm "frmLookupMeetings"
cmdDeleteExit:
Exit Sub
cmdDeleteErrorHandler:
Resume cmdDeleteExit
End Sub


This one is attached to the Save button:

Private Sub cmdSave_Click()
On Error GoTo cmdSaveErrorHandler
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acDefault
DoCmd.OpenForm "frmLookupMeetings"
cmdSaveExit:
Exit Sub
cmdSaveErrorHandler:
MsgBox "Complete required fields before saving this record.", vbOKOnly
+
vbInformation, " Missing Data"
DoCmd.GoToControl "cboMeetingTopicID"
Resume cmdSaveExit
End Sub


Do I need to modify any of the above for it to work. If so, how? If not,
what's going wrong?

As always, thanks for your help.

Rene
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Outlook events stop work randomly 0
Audit Trail 1
Case vbNo 5
My code not work ===> Case vbNo 9
SetWarning False.....? 10
Unable to send email in HTML format 1
command button validation 2
search command 2

Top