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
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