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

How to make MS-Access Log file?

180 100+
Hi Guys
I need to set up or create a routine will keep a log file of what was done by whom
Is there any easy way or is it implemented already in Ms access 2007, i need a log file which keeps track of any interaction(abcd) with the database

Any idea, somebody already did it, any example, please let me know
Jan 10 '11 #1

✓ answered by Oralloy

eneyardi,

The problem with audit trails in Access is that there is no database level mechanism that implements auditing.

What that means is that you have to implement auditing as a part of your application. If the user can access a table directly, without going through a form (or other programatic) interface, then the audit trail can not track every desired change.

The code example I provided is just a simple module to write audit trail records to a table in the database; nothing more. It's the core of an application level audit trail implementation. What you choose to write is, of course, up to you. If all you want to do is record "new" records, then that's all you have to audit. If you want more sophisticated auditing and information, you'll have to implement it.

Am I making sense?

9 26037
Depending on exactly what you want to track then the tracking table could become huge.
the way I would go about it is to have every user login with a unique id, have a table called tracking with fields somewhat like Userid( obviously the user logged in ) When(date and time)Formname(name of form accessed by user) Operation( values of viewed, edit,add,delete,recordnum,field)
Each time a form is opened, record edited, deleted, added the event fired writes info to the tracking table
Don't know if this would reduce application sped too much, never tried it out. My thoughts anyhow on possible way to implement. ; )
Jan 10 '11 #2
eneyardi
180 100+
Thanks, just what i thought too, our 4380 records will be multiplied for only to view every records routing history. i can depend it now on program presentation that is not adviceable to have that function.
Jan 10 '11 #3
Oralloy
988 Expert 512MB
eneyrardi,

I've built audit-trails into access before. They aren't difficult. You can hide the whole thing in a module with one or two interface functions, and it's done.

The problem is not in implementing the data storage mechanism. The execution time for the mechanism is generally so small, that it's never a concern.

Where the problem lies is in determining what to audit and how. For example, if the user has unrestricted access to a table, you will basically be unable to audit the changes. On the other hand, if all data access is controlled through a forms based application, you can simply capture each record write event and implement the audit there.

Needless to say, this can get to be messy, quickly.

Also, be careful about what you record. I worked on a database once, where we regularly wrote measurement 100,000 data records. In this situation, there is almost no value in tracking each data record; instead, the top-level measurement is more the item to track.

So - be sure of your requirements, and be certain you can even record the information. Requirements, requirements, requirements.

Hopefully that helps a little.

Cheers!
Oralloy
Jan 10 '11 #4
eneyardi
180 100+
How to do the audit-trails into access 2007?
Jan 11 '11 #5
eneyardi
180 100+
Can u send me a link of a sample program of audit_trails?
Jan 11 '11 #6
Oralloy
988 Expert 512MB
Well, it's pretty simple, actually:

I'm doing this off the cuff, so please bear with my mistakes.
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE [Audit Trail]
  2. (
  3.   id AUTONUMBER NOT NULL PRIMARY KEY,
  4.   user CHAR(16) NOT NULL,
  5.   timestamp DATETIME NOT NULL,
  6.   action CHAR(254) NOT NULL,
  7.   description CHAR(254),
  8.   comment MEMO,
  9. );
And perhaps a subs to insert records:
Expand|Select|Wrap|Line Numbers
  1. Public Sub log(ByVal action As String, _
  2.                Optional ByVal description As Variant = Empty, _
  3.                Optional ByVal memo As Variant = Empty)
  4.   Dim q As String
  5.  
  6.   q = "INSERT INTO [Audit Trail] " & vbCrLf
  7.   q = q & "  ([user], [timestamp], [action], [description], [memo]) " & vbCrLf
  8.   q = q & "  VALUES('" & UserName() & "', " & vbCrLf
  9.   q = q & "         #" & Now() & "#, " & vbCrLf
  10.   q = q & "         '" & action & "', " & vbCrLf
  11.   q = q & "         " & IIf(IsEmpty(description), "NULL", "'" & description & "'") & ", " & vbCrLf
  12.   q = q & "         " & IIf(IsEmpty(memo), "NULL", "'" & memo & "'") & ")"
  13.  
  14.   Database.Execute(q)
  15. End Sub
At least, that's a quick-and-dirty start.

Better to use parameterized query, that way you don't have to worry about value translations, quoting, or recordlimits.

Good Luck!
Oralloy
Jan 11 '11 #7
eneyardi
180 100+
thanks, its pretty cool but it saves all the changes in records. i want only those add record to be audit, how to do that buddy?
Jan 12 '11 #8
Oralloy
988 Expert 512MB
eneyardi,

The problem with audit trails in Access is that there is no database level mechanism that implements auditing.

What that means is that you have to implement auditing as a part of your application. If the user can access a table directly, without going through a form (or other programatic) interface, then the audit trail can not track every desired change.

The code example I provided is just a simple module to write audit trail records to a table in the database; nothing more. It's the core of an application level audit trail implementation. What you choose to write is, of course, up to you. If all you want to do is record "new" records, then that's all you have to audit. If you want more sophisticated auditing and information, you'll have to implement it.

Am I making sense?
Jan 12 '11 #9
eneyardi
180 100+
i get it now, thanks alot..
Jan 13 '11 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: BOOGIEMAN | last post by:
Well that's it, how do I make Windows Application with Python ??? Is there simple way that works 100% ? How can I rework visual design done in VS 2003 to use it for my python program ?
9
by: CY FOK | last post by:
Hi I am planning to open a software company to develop client-server apps and web applications for my client. Now, i am in a difficult situation to determine what is the best platform i should use...
3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
2
by: Dean | last post by:
I have already install my Microsoft SQL server 2000 as not case sensitive, how to I change it to be case sensitive?
0
by: Sean W. | last post by:
I want to create a list of MS servers using VB.NET. Where do I start? Also, one I have the list I want to be able to check the diskspace available on each server. This is just for daily...
3
by: Christian McArdle | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.os.ms-windows.programmer.64bit This is a formal Request For Discussion (RFD) to create comp.os.ms-windows.programmer.64bit as an unmoderated...
18
by: Rob R. Ainscough | last post by:
MS Visual Studio Ad contained in VS Magazine. Two developers in "hip" clothing diagramming out a huge flow chart on a beach. I could NOT stop laughing at the stupidity of the ad -- "Let your...
5
by: John Smith | last post by:
Hey folks, I'm creating an MS Word document in a C# Windows application. Because the client base has so many different versions of Word they are using, I opted to go with late binding to create...
7
by: Joe Ross | last post by:
I've been working with Microsoft support for over 3 weeks now on an intermittent General Network Error we're seeing in our production environment between our ASP.NET application and SQL Server...
42
by: Martin Jørgensen | last post by:
Hi, I'm trying to move a matlab program into c language. For those who knows matlab, this is the line I want to program in c: hx(1:nx,1:ny) = 0; % nx=10, ny=10 It works on a 2-dimensional...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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,...

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.