473,385 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Question about audit trail code

I created an audit trail for my access 97 database using code I found
at: http://members.iinet.net.au/~allenbrowne/AppAudit.html
One of the limitations stated for the code is "each table to be audited
must have an AutoNumber primary key". Can someone explain why the
automunber field has to be the primary key? It seems that the
autonumber field would be unique by default. I have another field that
needs to be unique but there is nothing to prevent the user from
entering duplicate values without making it the primary key or by
adding code. If I understood this limitation further, I may be able to
come up with a solution.

Thanks,

Michael

Nov 13 '05 #1
5 2486
The routines generate a record based on the primary key value. The primary
key must be a Number type field - not a Text field, because of the way the
variables are passed to the procedures and the way the SQL strings are
built. Although AutoNumber is probably the most common kind, an Integer or
Long Integer primary key would be okay.

BTW, the site will be moving to a different server soon, so the best address
to find it will be:
http://allenbrowne.com/AppAudit.html

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

<br****@aol.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I created an audit trail for my access 97 database using code I found
at: http://members.iinet.net.au/~allenbrowne/AppAudit.html
One of the limitations stated for the code is "each table to be audited
must have an AutoNumber primary key". Can someone explain why the
automunber field has to be the primary key? It seems that the
autonumber field would be unique by default. I have another field that
needs to be unique but there is nothing to prevent the user from
entering duplicate values without making it the primary key or by
adding code. If I understood this limitation further, I may be able to
come up with a solution.

Thanks,

Michael

Nov 13 '05 #2


--
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.
<br****@aol.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I created an audit trail for my access 97 database using code I found
at: http://members.iinet.net.au/~allenbrowne/AppAudit.html
One of the limitations stated for the code is "each table to be audited
must have an AutoNumber primary key". Can someone explain why the
automunber field has to be the primary key? It seems that the
autonumber field would be unique by default. I have another field that
needs to be unique but there is nothing to prevent the user from
entering duplicate values without making it the primary key or by
adding code. If I understood this limitation further, I may be able to
come up with a solution.

Thanks,

Michael

Nov 13 '05 #3
DFS
Allen Browne wrote:
The routines generate a record based on the primary key value. The
primary key must be a Number type field - not a Text field, because
of the way the variables are passed to the procedures and the way the
SQL strings are built. Although AutoNumber is probably the most
common kind, an Integer or Long Integer primary key would be okay.

BTW, the site will be moving to a different server soon, so the best
address to find it will be:
http://allenbrowne.com/AppAudit.html

Allen,

Looks like a handy program.

I notice you don't log changes made for relationships containing cascaded
updates or deletes. You probably already know this, but if you wanted to
track those changes, it can be accomplished by polling MSysRelationships.

Column grbit will contain:
0 if neither cascade updates or deletes is set
256 if cascade updates only is set
4096 if cascade deletes only is set
4352 if both cascade updates and deletes is set.

If I contribute the code, will you look at it, or include it in your system?

Thanks
<br****@aol.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I created an audit trail for my access 97 database using code I found
at: http://members.iinet.net.au/~allenbrowne/AppAudit.html
One of the limitations stated for the code is "each table to be
audited must have an AutoNumber primary key". Can someone explain
why the automunber field has to be the primary key? It seems that
the autonumber field would be unique by default. I have another
field that needs to be unique but there is nothing to prevent the
user from entering duplicate values without making it the primary
key or by adding code. If I understood this limitation further, I
may be able to come up with a solution.

Thanks,

Michael

Nov 13 '05 #4
That would need a fairly serious rework of the concept.

As currently set up, each table being edited has to be duplicated with
changed indexes and rules and additional fields to record the date/time and
user who made the change. So any tables involved in cascades would need
their matching audit table created as well, to write the audit to.
Alternatively, the audit structure could be handled relationally where we
log the table name, field name, old value, new value, date/time, and user,
on a field-by-field basis instead of a table-by-table basis.

Once the structure is in place, it would be possible to read the attributes
of the relation as you suggest, and identify the kind of change that will
occur (cascade-update, cascade-delete, cascade-to-null, or a combination),
and log the change.

Another aspect is that a cascade to a related table can also have further
cascades to other tables, so you would need to write the code recursively to
handle those as well. From memory, JET does not block circular cascades, so
you would need to test each branch of the cascade to see if that occurs
anywhere. Sounds like quite an interesting challenge if you feel like
persuing it.

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

"DFS" <no****@DFS.com> wrote in message
news:E4******************@fe03.lga...
Allen Browne wrote:
The routines generate a record based on the primary key value. The
primary key must be a Number type field - not a Text field, because
of the way the variables are passed to the procedures and the way the
SQL strings are built. Although AutoNumber is probably the most
common kind, an Integer or Long Integer primary key would be okay.

BTW, the site will be moving to a different server soon, so the best
address to find it will be:
http://allenbrowne.com/AppAudit.html

Allen,

Looks like a handy program.

I notice you don't log changes made for relationships containing cascaded
updates or deletes. You probably already know this, but if you wanted to
track those changes, it can be accomplished by polling MSysRelationships.

Column grbit will contain:
0 if neither cascade updates or deletes is set
256 if cascade updates only is set
4096 if cascade deletes only is set
4352 if both cascade updates and deletes is set.

If I contribute the code, will you look at it, or include it in your
system?

Thanks

Nov 13 '05 #5
DFS
Allen Browne wrote:
That would need a fairly serious rework of the concept.

As currently set up, each table being edited has to be duplicated with
changed indexes and rules and additional fields to record the
date/time and user who made the change. So any tables involved in
cascades would need their matching audit table created as well, to
write the audit to. Alternatively, the audit structure could be
handled relationally where we log the table name, field name, old
value, new value, date/time, and user, on a field-by-field basis
instead of a table-by-table basis.

Once the structure is in place, it would be possible to read the
attributes of the relation as you suggest, and identify the kind of
change that will occur (cascade-update, cascade-delete,
cascade-to-null, or a combination), and log the change.

Another aspect is that a cascade to a related table can also have
further cascades to other tables, so you would need to write the code
recursively to handle those as well. From memory, JET does not block
circular cascades, so you would need to test each branch of the
cascade to see if that occurs anywhere. Sounds like quite an
interesting challenge if you feel like persuing it.
I might. Also interesting and challenging would be constructing a
checkpoint and rollback system based on the audit trail.

"DFS" <no****@DFS.com> wrote in message
news:E4******************@fe03.lga...
Allen Browne wrote:
The routines generate a record based on the primary key value. The
primary key must be a Number type field - not a Text field, because
of the way the variables are passed to the procedures and the way
the SQL strings are built. Although AutoNumber is probably the most
common kind, an Integer or Long Integer primary key would be okay.

BTW, the site will be moving to a different server soon, so the best
address to find it will be:
http://allenbrowne.com/AppAudit.html

Allen,

Looks like a handy program.

I notice you don't log changes made for relationships containing
cascaded updates or deletes. You probably already know this, but if
you wanted to track those changes, it can be accomplished by polling
MSysRelationships.

Column grbit will contain:
0 if neither cascade updates or deletes is set
256 if cascade updates only is set
4096 if cascade deletes only is set
4352 if both cascade updates and deletes is set.

If I contribute the code, will you look at it, or include it in your
system?

Thanks

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Raphael Gluck | last post by:
Hi, Is it possible for one to program one's pages as such that when a database table is updated over the web, via a form, that an e-mail confirmation is sent to a specified address, notifying...
3
by: Zlatko Matić | last post by:
Hello. I tried to implement audit trail, by making an audit trail table with the following fileds: TableName,FieldName,OldValue,NewValue,UpdateDate,type,UserName. Triggers on each table were...
8
by: allyn44 | last post by:
Helllo--I have implemented the audit trail from the Microsoft KB article that records changes on a data entry form to a memo filed in the fieeld's table record. What I would like to do is pull...
17
by: (PeteCresswell) | last post by:
I've got apps where you *really* wouldn't want to delete certain items by accident, but the users just have to have a "Delete" button. My current strategies: Plan A:...
3
by: hary08 | last post by:
im doing a database for Hospital Admission, I have a log in form which prompt user for a password. The source of log in is to look for the values in my Table tblEmployees and match user name and...
2
by: rockdc1981 | last post by:
I dont it is possible to put this codes together.. I want to prompt the user to save the record and at the same time have a log of audit trail. the codes work out fine separately. Code for Audit...
12
by: nyathancha | last post by:
Hi, I have a question regarding best practices in database design. In a relational database, is it wise/necessary to sometimes create tables that are not related to other tables through a...
6
by: babamc4 | last post by:
I have a main form (mainformlung) with 5 subforms (followupacute, followuplate, biochemresults, haemresults and pftresults). I have copied Allen Browne's Audit Trail code (thanks to Allen Browne)...
16
by: zandiT | last post by:
hello i'm using the microsoft audit trail example ACC2000: How to Create an Audit Trail of Record Changes in a Form and im having a problem with my recordset. in the example they are using a...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.