Audit Trail

R

Rene

Good morning,

I copied Allen Browne's VBA code into a standard module and followed each
step (http://allenbrowne.com/AppAuditCode.html). 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
 
A

Arvin Meyer [MVP]

The way to find errors in code is to set a breakpoint after the Dim
statements and trigger the event that you wish to check. Step through the
code, using F8 until it errors or does something unpredictable.
 
A

a a r o n . k e m p f

Audit Trails are built into SQL Server, stop trying to write mountains
of code to reinvent the wheel, prick
 
A

a a r o n . k e m p f

rude?

why should you possibly program something by hand that is built into
SQL 2008?
 
A

a a r o n . k e m p f

Dude stop being such a friggin pansy.. Grow some balls, and learn a
real database, faggot nark

-Aaron
 
A

a a r o n . k e m p f

why should you possibly program something by hand that is built into
SQL 2008?
 

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

Top