audit users in ms database access 2003

G

Guest

Hi, wondering if anyone out there can help me with this. I am using Allen
Browne's audit codes but it doesn't record any changes/additions/deletions to
the audit table.

I think I followed through all the steps in AppAudit.html. I created a test
table named "Test" with two fields Fields1 and InvoiceID (AutoNumber). I
make a copy of "Test" and named it "audTempTest" changing InvoiceId to Number
Long Interger type , removing validation and primary key. I add 3 fields to
"audTempTest": audType, audDate, and audUser. I copy "audTempTest" and
named it "audTest" and add an autonumber filed named audID and make it
primary key.

I copied the 6 lines of code to OnDelete, AfterDelConfirm, BeforeUpdate, and
AfterUpdate.

I created a form to enter data to "Test" table. When I added/deleted/made
changes, nothing was recorded to audTest. Help!

Thanks.
 
D

Douglas J Steele

Is the code in OnDelete, AfterDelConfirm, BeforeUpdate, and AfterUpdate
actually getting called?

Sometimes, modules get disassociated from the objects whose events they're
supposed to be linked to.
 
G

Guest

I appreciate you taking time from your busy schedule to read and respond to
my email! It really means a lot to me knowing that there are people out
there willing to solve my problems!

I figured out what the problem was, I had mispelled the name of the table
which was being audited in two of the codes from Allen Browne's codes.

I have another problem, which you are trying to explain in your email. Now
I got the audit table to record something (YES!). It is only recording
records that are added, but not records that are deleted/changed.

I believe some of the event codes aren't being called in the form's events.
Why aren't the events being called?

Another thing: Below are codes in the form's events: If I take out the
brackets in "InvoiceID" I get this error: "Compile Error: Method or Data
member Not Found"
It works fine with the brackets. I think this may have something to do with
why the audit table isn't recording the deletions/changes.

Public Sub Form_AfterUpdate()
Call AuditEditEnd("Test", "audTmpTest", "audTest", "InvoiceID",
Nz(Me![InvoiceID], 0), bWasNewRecord)
End Sub

Public Sub Form_BeforeUpdate(Cancel As Integer)
bWasNewRecord = Me.NewRecord
Call AuditEditBegin("Test", "audTmpTest", "InvoiceID", Nz(Me.[InvoiceID],
0), bWasNewRecord)
End Sub

Public Sub Form_Delete(Cancel As Integer)
Call AuditDelBegin("Test", "audTmpTest", "InvoiceID", Nz(Me.[InvoiceID], 0))
 
A

Allen Browne

Temporarily comment out the error-handler in each of those routined, e.g.:
'On Error Goto...

You should now be able to see where the code is failing, and you can then
determine if it is a misspelling, or a field missing, or fields in the wrong
order, or ...

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Chai said:
I appreciate you taking time from your busy schedule to read and respond to
my email! It really means a lot to me knowing that there are people out
there willing to solve my problems!

I figured out what the problem was, I had mispelled the name of the table
which was being audited in two of the codes from Allen Browne's codes.

I have another problem, which you are trying to explain in your email.
Now
I got the audit table to record something (YES!). It is only recording
records that are added, but not records that are deleted/changed.

I believe some of the event codes aren't being called in the form's
events.
Why aren't the events being called?

Another thing: Below are codes in the form's events: If I take out the
brackets in "InvoiceID" I get this error: "Compile Error: Method or Data
member Not Found"
It works fine with the brackets. I think this may have something to do
with
why the audit table isn't recording the deletions/changes.

Public Sub Form_AfterUpdate()
Call AuditEditEnd("Test", "audTmpTest", "audTest", "InvoiceID",
Nz(Me![InvoiceID], 0), bWasNewRecord)
End Sub

Public Sub Form_BeforeUpdate(Cancel As Integer)
bWasNewRecord = Me.NewRecord
Call AuditEditBegin("Test", "audTmpTest", "InvoiceID", Nz(Me.[InvoiceID],
0), bWasNewRecord)
End Sub

Public Sub Form_Delete(Cancel As Integer)
Call AuditDelBegin("Test", "audTmpTest", "InvoiceID", Nz(Me.[InvoiceID],
0))

Douglas J Steele said:
Is the code in OnDelete, AfterDelConfirm, BeforeUpdate, and AfterUpdate
actually getting called?

Sometimes, modules get disassociated from the objects whose events
they're
supposed to be linked to.
 
G

Guest

I commented out the error-handler in each of the routines but it gave me more
problems. In my previous posting, I said that the audit table is only
recording records that are added but not records that are deleted/edited. I
don't know if the
the code in OnDelete, AfterDelConfirm, and BeforeUpdate are getting called.


Allen Browne said:
Temporarily comment out the error-handler in each of those routined, e.g.:
'On Error Goto...

You should now be able to see where the code is failing, and you can then
determine if it is a misspelling, or a field missing, or fields in the wrong
order, or ...

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Chai said:
I appreciate you taking time from your busy schedule to read and respond to
my email! It really means a lot to me knowing that there are people out
there willing to solve my problems!

I figured out what the problem was, I had mispelled the name of the table
which was being audited in two of the codes from Allen Browne's codes.

I have another problem, which you are trying to explain in your email.
Now
I got the audit table to record something (YES!). It is only recording
records that are added, but not records that are deleted/changed.

I believe some of the event codes aren't being called in the form's
events.
Why aren't the events being called?

Another thing: Below are codes in the form's events: If I take out the
brackets in "InvoiceID" I get this error: "Compile Error: Method or Data
member Not Found"
It works fine with the brackets. I think this may have something to do
with
why the audit table isn't recording the deletions/changes.

Public Sub Form_AfterUpdate()
Call AuditEditEnd("Test", "audTmpTest", "audTest", "InvoiceID",
Nz(Me![InvoiceID], 0), bWasNewRecord)
End Sub

Public Sub Form_BeforeUpdate(Cancel As Integer)
bWasNewRecord = Me.NewRecord
Call AuditEditBegin("Test", "audTmpTest", "InvoiceID", Nz(Me.[InvoiceID],
0), bWasNewRecord)
End Sub

Public Sub Form_Delete(Cancel As Integer)
Call AuditDelBegin("Test", "audTmpTest", "InvoiceID", Nz(Me.[InvoiceID],
0))

Douglas J Steele said:
Is the code in OnDelete, AfterDelConfirm, BeforeUpdate, and AfterUpdate
actually getting called?

Sometimes, modules get disassociated from the objects whose events
they're
supposed to be linked to.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hi, wondering if anyone out there can help me with this. I am using
Allen
Browne's audit codes but it doesn't record any
changes/additions/deletions
to
the audit table.

I think I followed through all the steps in AppAudit.html. I created a
test
table named "Test" with two fields Fields1 and InvoiceID (AutoNumber).
I
make a copy of "Test" and named it "audTempTest" changing InvoiceId to
Number
Long Interger type , removing validation and primary key. I add 3
fields
to
"audTempTest": audType, audDate, and audUser. I copy "audTempTest"
and
named it "audTest" and add an autonumber filed named audID and make it
primary key.

I copied the 6 lines of code to OnDelete, AfterDelConfirm,
BeforeUpdate,
and
AfterUpdate.

I created a form to enter data to "Test" table. When I
added/deleted/made
changes, nothing was recorded to audTest. Help!

Thanks.
 
A

Allen Browne

To test if the OnDelete code is being called, try deleting a record.
Provided the error handler is commented out, Access will highlight the
problem line of code when it fails.

You will need to have an understanding of VBA and SQL to understand what is
wrong and how to fix it. You will ultimately trace it to one of the things
listed in my previous reply.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Chai said:
I commented out the error-handler in each of the routines but it gave me
more
problems. In my previous posting, I said that the audit table is only
recording records that are added but not records that are deleted/edited.
I
don't know if the
the code in OnDelete, AfterDelConfirm, and BeforeUpdate are getting
called.
[snip]
 
G

Guest

I commented out the error-handler and found out that my temp table was
mispelled. Now when I edit/delete/add records it records it in the audit
table. Thanks a lot!!!!!!!!


Allen Browne said:
To test if the OnDelete code is being called, try deleting a record.
Provided the error handler is commented out, Access will highlight the
problem line of code when it fails.

You will need to have an understanding of VBA and SQL to understand what is
wrong and how to fix it. You will ultimately trace it to one of the things
listed in my previous reply.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Chai said:
I commented out the error-handler in each of the routines but it gave me
more
problems. In my previous posting, I said that the audit table is only
recording records that are added but not records that are deleted/edited.
I
don't know if the
the code in OnDelete, AfterDelConfirm, and BeforeUpdate are getting
called.
[snip]
 

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