G
Guest
I am working on a database that is used at a number of similar organisations.
I recently added an audit trail to this using a slightly adapted version of
an example I found on this newsgroup.
This consists of calling a module BeforeUpdate which assigns any changes
into an invisible field and running the following code AfterUpdate to assign
the change into an Audit Trail table:
Private Sub Form_AfterUpdate()
On Error GoTo Err_AfterUpdate_Click
Dim strName As String, StrSql As String
Dim FormID As String
Dim Changes As String
strName = CurrentUser()
FormID = "Demographic"
StrSql = "INSERT INTO AuditTrail (ID, FormID, ChangedBy, ChangesMade) " & _
"Values ('" & [ID] & "', '" & FormID & "', '" & strName &
"', '" & tbAuditTrail & "' )"
CurrentDb().Execute StrSql
Exit_AfterUpdate_Click:
Exit Sub
Err_AfterUpdate_Click:
MsgBox Err.Description
Resume Exit_AfterUpdate_Click
End Sub
This works extremely well at most of the sites, with the exception of one
where the message "You can't carry out this action at the present time"
appears when the user closes one form after making a change to go back to
another which is still open. The forms then appear to freeze and the message
appears regardless on which command button she clicks. The user has to close
down altogether and then go back in.
The message does not show up all the time and I am having real difficulty
working out what it is trying to tell me.
The computers on the site in question use a mixture of Access 2000 and
Access 2003 so the form file is still in 2000 although the user is running
2003.
Any ideas or pointers would be seriously appreciated.
Thanks in advance
I recently added an audit trail to this using a slightly adapted version of
an example I found on this newsgroup.
This consists of calling a module BeforeUpdate which assigns any changes
into an invisible field and running the following code AfterUpdate to assign
the change into an Audit Trail table:
Private Sub Form_AfterUpdate()
On Error GoTo Err_AfterUpdate_Click
Dim strName As String, StrSql As String
Dim FormID As String
Dim Changes As String
strName = CurrentUser()
FormID = "Demographic"
StrSql = "INSERT INTO AuditTrail (ID, FormID, ChangedBy, ChangesMade) " & _
"Values ('" & [ID] & "', '" & FormID & "', '" & strName &
"', '" & tbAuditTrail & "' )"
CurrentDb().Execute StrSql
Exit_AfterUpdate_Click:
Exit Sub
Err_AfterUpdate_Click:
MsgBox Err.Description
Resume Exit_AfterUpdate_Click
End Sub
This works extremely well at most of the sites, with the exception of one
where the message "You can't carry out this action at the present time"
appears when the user closes one form after making a change to go back to
another which is still open. The forms then appear to freeze and the message
appears regardless on which command button she clicks. The user has to close
down altogether and then go back in.
The message does not show up all the time and I am having real difficulty
working out what it is trying to tell me.
The computers on the site in question use a mixture of Access 2000 and
Access 2003 so the form file is still in 2000 although the user is running
2003.
Any ideas or pointers would be seriously appreciated.
Thanks in advance