473,419 Members | 1,618 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,419 software developers and data experts.

Creating an audit trail in Access 2000

Dear Sirs,

Having previously used other SQL implementations I have grown used to
having an audit trail to find when problems occured, the problem I am
increasingly finding with Access is that there is no 'inbuilt' audit
trail for me to see what has happend to the database to get it into its
current state.

Is there a way to make Access 2002 (in 2000 mode) to generate a log of
ALL changes to table data ? A time/datestamp to start with would be
good, but eventually with a source hostname/IP would be good.

Many thanks in advance for your kind help,
Regards,

Alan Knipmeyer.
--
IT Technician

Nov 13 '05 #1
5 2151
al***********@yahoo.com wrote in message news:<10**********************@c13g2000cwb.googleg roups.com>...
Dear Sirs,

Having previously used other SQL implementations I have grown used to
having an audit trail to find when problems occured, the problem I am
increasingly finding with Access is that there is no 'inbuilt' audit
trail for me to see what has happend to the database to get it into its
current state.

Is there a way to make Access 2002 (in 2000 mode) to generate a log of
ALL changes to table data ? A time/datestamp to start with would be
good, but eventually with a source hostname/IP would be good.

Many thanks in advance for your kind help,
Regards,

Alan Knipmeyer.


See Allen Browne's website. He has code for this and instructions.
Nov 13 '05 #2
Chuck Grimsby <c.*******@worldnet.att.net.invalid> wrote:
Allen Browne has an example of how to do it on his site however, and I
strongly encourage it's reading:
<http://members.iinet.net.au/~allenbrowne/AppAudit.html>


I gratefully used Allen's method for ages but found that querying it took
ages too and it also stores a lot of static data. I developed my own method
of tracking changes which I'll evetually put on my web site.

I have the following code in my form's before update event (DAO in A97):

****
Dim ctl As Control
Dim db As Database, rs As Recordset, strSQL As String
Set db = CurrentDb
strSQL = "Select * From qryHistory;"
Set rs = db.OpenRecordset(strSQL)

For Each ctl In Me.Detail.Controls
'Ignore controls such as labels
If ctl.Name Like "cmd*" Then GoTo Skip
If ctl.SpecialEffect = 0 Then GoTo Skip
If ctl.Name Like "txt*" Or ctl.Name Like "cbo*" Or ctl.Name Like
"ogr*" Or ctl.Name Like "chk*" Then
'Record null to value, value to null, and value changes
If (IsNull(ctl.OldValue) And Not IsNull(ctl.Value)) Or
(IsNull(ctl.Value) And Not IsNull(ctl.OldValue)) _
Or ctl.OldValue <> ctl.Value Then
'MsgBox ctl.name
With rs
.AddNew
![DataSource] = "MyTable"
![ID] = Me.txtID
![FieldName] = ctl.ControlSource
![OldValue] = ctl.OldValue
![NewValue] = ctl.Value
![UpdatedBy] = CurrentUser
![UpdatedWhen] = Now()
.Update
End With
End If
End If
Skip:
Next

rs.Close
Set rs = Nothing
db.Close
Set db = Nothing

****

The code cycles through controls with data sources and fires the update
routine when it finds one that has changed. This keeps the amount of stored
data to a minimum and you can call the data from a 'history' form if you
want.

HTH - Keith.
www.keithwilby.com
Nov 13 '05 #3
Chuck Grimsby <c.*******@worldnet.att.net.invalid> wrote:
You may want to look at using the TypeOf operator in your code to
select what controls for your code to work on/with


Hi Chuck, thanks for the info.

I did try the TypeOf method first but I seem to remember hitting a snag
(can't quite remember what it was), maybe I'll revisit that soon :o)

Keith.
www.keithwilby.com
Nov 13 '05 #4
Hi Keith,
Thanks for your great function for creating an Audit Trail. To
eliminate labels and other unwanted stuff I used the following
structure.
If ((ctl.ControlType = acTextBox) Or _
(ctl.ControlType = acComboBox) Or _
(ctl.ControlType = acCheckBox) Or _
(ctl.ControlType = acOptionGroup)) Then

Then I limited my search to the controls I was editing
strControlName = ctl.Name
If (Me(strControlName).Locked = False) Then

Hank Reed
Nov 13 '05 #5
ha********@aol.com (Hank Reed) wrote:
To
eliminate labels and other unwanted stuff I used the following
structure.
If ((ctl.ControlType = acTextBox) Or _
(ctl.ControlType = acComboBox) Or _
(ctl.ControlType = acCheckBox) Or _
(ctl.ControlType = acOptionGroup)) Then

Then I limited my search to the controls I was editing
strControlName = ctl.Name
If (Me(strControlName).Locked = False) Then


Cheers Hank, will look into that.

Regards,
Keith.
www.keithwilby.com
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...
2
by: Keith | last post by:
Hi I am developing an ASP application which will interact with a SQL database. A requirement of the application is that there is a full audit trail of any modifications to data. I am...
0
by: Me | last post by:
Hi... A much lamented question, I guess.. I'm trying to create a simple audit trail. log the changes to an SQL 2000 table, so that they are written into a mirror table. The entire record, only...
3
by: Me | last post by:
Hi... A much lamented question, I guess.. I'm trying to create a simple audit trail. log the changes to an SQL 2000 table, so that they are written into a mirror table. The entire record, only...
6
by: Parag | last post by:
Hello, I have been assigned the task to design the audit trail for the ASP.NET web application. I don't know what the best practices for such audit trails are. Our application one dedicated user...
0
by: JimLad | last post by:
Hi, I've been tasked with reviewing the Authentication and Auditing of an application and database. ASP/ASP.NET 1.1 app with SQL Server 2000 database. Separate audit trail database on same...
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...
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)...
4
by: Emin | last post by:
Dear Experts, We need to design a database which has an audit trail for updates to a certain set of tables. The two main approaches I've seen for this include shadow tables (an extra table to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.