A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Creating an audit log



 
 
Thread Tools Display Modes
  #11  
Old December 14th, 2006, 02:33 PM posted to microsoft.public.access
George McDonald
external usenet poster
 
Posts: 17
Default Creating an audit log

Allen

Renaming the module has stopped the error log ok. This is now bringing me
back to the start of my question.

When I enter a new record the information is logged on the aud table ok.
When I go back to the record and add a further piece of data this is getting
logged on the tmp table and the info on the aud table is deleted. I dont have
any error messages when this is processing.

Am I correct in thinking that the aud table should keep all data for every
new record and also any changes that happen to the table.

Thanks for your patience

George

"Allen Browne" wrote:

Rename the module to "Module2" or something.

The modue's name must not be the same as the procedures, e.g. it must not be
called LogError.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"George McDonald" wrote in
message
...
Compile Error
Expected variable or procedure,not module.

George

"Allen Browne" wrote:

What does the message say?

Syntax error?
Undefined function?
Other?

"George McDonald" wrote in
message
...
Allen, I have created a table tlogerror withe the fields listed in your
article. I have copied the code and saved it as a new module logerror.
When I
run Debug compile it is stopping at Call Logerror at Err_Handler. Can
you
help again please

George

"Allen Browne" wrote:

Ah: did you copy the LogError() function as well?
The link is:
http://allenbrowne.com/ser-23a.html

"George McDonald" wrote in
message
...
Allen

The code is logging an error at auditeditbegin with Call LogError
being
highlighted, any suggestions please.

George

"Allen Browne" wrote:

If you are referring to this article:
http://allenbrowne.com/AppAudit.html
it makes no difference whether the database is split.

While you are debugging, make sure the error handler is disabled at
the
top
of the 4 functions, by leaving the single quote at the start of
this
line:
'On Error GoTo ...

Now when if fails, you can see which line did not complete
properly.

You can also add the a line to the top of each procedure containing
just:
Stop
When it runs, it will stop at this line, and you can press F8 to
execute
one
line at a time, so you can check out what's going on.

"George McDonald" wrote
in
message
...
I have used Allen Browne's article to create an audit log for my
database.
On
insert the work is listed fine on the audit table, listing
everything
that
has been added. The problem is when I edit the record. The edit
is
still
on
the tmp table and all records have been deleted from the aud
table.
Can
you
help please? I dont have a split database it is all together,
could
this
be
the problem.




  #12  
Old December 14th, 2006, 02:48 PM posted to microsoft.public.access
Allen Browne
external usenet poster
 
Posts: 11,706
Default Creating an audit log

Yes: it should keep a complete history, not just the earliest or lastest
change.

If you are getting no errors, does the code actually fire? Add the line:
Stop
to the top of each procedure.

If it is running, you can add:
Debug.Print sSQL
to see the SQL statement that is executing. Is it right?

After each line starting with "db.Execute ...", add this line:
Debug.Print db.RecordsAffected
so you can see if a record was inserted, deleted, or whatever.

The code does work: I've been using it for nearly 10 years.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"George McDonald" wrote in
message
...
Allen

Renaming the module has stopped the error log ok. This is now bringing me
back to the start of my question.

When I enter a new record the information is logged on the aud table ok.
When I go back to the record and add a further piece of data this is
getting
logged on the tmp table and the info on the aud table is deleted. I dont
have
any error messages when this is processing.

Am I correct in thinking that the aud table should keep all data for every
new record and also any changes that happen to the table.

Thanks for your patience

George

"Allen Browne" wrote:

Rename the module to "Module2" or something.

The modue's name must not be the same as the procedures, e.g. it must not
be
called LogError.

"George McDonald" wrote in
message
...
Compile Error
Expected variable or procedure,not module.

George

"Allen Browne" wrote:

What does the message say?

Syntax error?
Undefined function?
Other?

"George McDonald" wrote in
message
...
Allen, I have created a table tlogerror withe the fields listed in
your
article. I have copied the code and saved it as a new module
logerror.
When I
run Debug compile it is stopping at Call Logerror at Err_Handler.
Can
you
help again please

George

"Allen Browne" wrote:

Ah: did you copy the LogError() function as well?
The link is:
http://allenbrowne.com/ser-23a.html

"George McDonald" wrote
in
message
...
Allen

The code is logging an error at auditeditbegin with Call LogError
being
highlighted, any suggestions please.

George

"Allen Browne" wrote:

If you are referring to this article:
http://allenbrowne.com/AppAudit.html
it makes no difference whether the database is split.

While you are debugging, make sure the error handler is disabled
at
the
top
of the 4 functions, by leaving the single quote at the start of
this
line:
'On Error GoTo ...

Now when if fails, you can see which line did not complete
properly.

You can also add the a line to the top of each procedure
containing
just:
Stop
When it runs, it will stop at this line, and you can press F8 to
execute
one
line at a time, so you can check out what's going on.

"George McDonald"
wrote
in
message
...
I have used Allen Browne's article to create an audit log for
my
database.
On
insert the work is listed fine on the audit table, listing
everything
that
has been added. The problem is when I edit the record. The
edit
is
still
on
the tmp table and all records have been deleted from the aud
table.
Can
you
help please? I dont have a split database it is all together,
could
this
be
the problem.



  #13  
Old December 14th, 2006, 04:43 PM posted to microsoft.public.access
George McDonald
external usenet poster
 
Posts: 17
Default Creating an audit log

Allen

I have never been in any doubt that your code would be the problem. I tried
adding stop in the code but I couldnt see anything wrong. I have copied your
code again and also reentered the code in the form. Whatever I have changed
it now works perfectly. Thanks for your help and patience

"Allen Browne" wrote:

Yes: it should keep a complete history, not just the earliest or lastest
change.

If you are getting no errors, does the code actually fire? Add the line:
Stop
to the top of each procedure.

If it is running, you can add:
Debug.Print sSQL
to see the SQL statement that is executing. Is it right?

After each line starting with "db.Execute ...", add this line:
Debug.Print db.RecordsAffected
so you can see if a record was inserted, deleted, or whatever.

The code does work: I've been using it for nearly 10 years.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"George McDonald" wrote in
message
...
Allen

Renaming the module has stopped the error log ok. This is now bringing me
back to the start of my question.

When I enter a new record the information is logged on the aud table ok.
When I go back to the record and add a further piece of data this is
getting
logged on the tmp table and the info on the aud table is deleted. I dont
have
any error messages when this is processing.

Am I correct in thinking that the aud table should keep all data for every
new record and also any changes that happen to the table.

Thanks for your patience

George

"Allen Browne" wrote:

Rename the module to "Module2" or something.

The modue's name must not be the same as the procedures, e.g. it must not
be
called LogError.

"George McDonald" wrote in
message
...
Compile Error
Expected variable or procedure,not module.

George

"Allen Browne" wrote:

What does the message say?

Syntax error?
Undefined function?
Other?

"George McDonald" wrote in
message
...
Allen, I have created a table tlogerror withe the fields listed in
your
article. I have copied the code and saved it as a new module
logerror.
When I
run Debug compile it is stopping at Call Logerror at Err_Handler.
Can
you
help again please

George

"Allen Browne" wrote:

Ah: did you copy the LogError() function as well?
The link is:
http://allenbrowne.com/ser-23a.html

"George McDonald" wrote
in
message
...
Allen

The code is logging an error at auditeditbegin with Call LogError
being
highlighted, any suggestions please.

George

"Allen Browne" wrote:

If you are referring to this article:
http://allenbrowne.com/AppAudit.html
it makes no difference whether the database is split.

While you are debugging, make sure the error handler is disabled
at
the
top
of the 4 functions, by leaving the single quote at the start of
this
line:
'On Error GoTo ...

Now when if fails, you can see which line did not complete
properly.

You can also add the a line to the top of each procedure
containing
just:
Stop
When it runs, it will stop at this line, and you can press F8 to
execute
one
line at a time, so you can check out what's going on.

"George McDonald"
wrote
in
message
...
I have used Allen Browne's article to create an audit log for
my
database.
On
insert the work is listed fine on the audit table, listing
everything
that
has been added. The problem is when I edit the record. The
edit
is
still
on
the tmp table and all records have been deleted from the aud
table.
Can
you
help please? I dont have a split database it is all together,
could
this
be
the problem.




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:35 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.