Audit Trail Option in Access (1 Viewer)

Khalil Islamzada

Registered User.
Local time
Today, 16:29
Joined
Jul 16, 2012
Messages
49
Hi Everyone;

I am developing a financial database in access program, I have one problem and hope you dears help me out;

I want to add Audit Trail option, that when any user enter, edit or delete data from database form, it will be recorded, I have searched already but the I found some audit trail which use windows logon user name, but I need access log on user name to be defined.

Thanks in advance dears.:confused::):banghead::confused:
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:59
Joined
Jul 9, 2003
Messages
16,286
What do you mean by:- "access log on user name"?
 

Khalil Islamzada

Registered User.
Local time
Today, 16:29
Joined
Jul 16, 2012
Messages
49
Users which I defined in access user table, which are different from windows logon users.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:59
Joined
Jul 9, 2003
Messages
16,286
And how do you record the "access log on user"
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:59
Joined
Jul 9, 2003
Messages
16,286
Where will you save the current user name?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:59
Joined
Jul 9, 2003
Messages
16,286
I think you missed my point, when the user logs in, you will need to record this event. How do you propose to do that?
 

Khalil Islamzada

Registered User.
Local time
Today, 16:29
Joined
Jul 16, 2012
Messages
49
Uncle Gizmo, I didn't make this option to record user logon event, which I need it too.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:59
Joined
Jul 9, 2003
Messages
16,286
You will need the facility to record the current user somewhere within your database before you can proceed to the Audit stage. (If you don't want to use the login Windows user.)
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:59
Joined
Jul 9, 2003
Messages
16,286
There are a variety of options that you can choose from for recording who the current logged in user is. Your choice will depend on what use you want to make the information.

For example if you want to be able to centrally interrogate the database and produce a list of current logged on users then one approach would be to store the list of the currently logged on users in a currently logged on user table.

However if you did not need this sort of facility then you could have a local variable to store the logged on users name possibly in a hidden form or a custom database property created for the purpose.

You should think about what you want to use the logged in user name for, and then search the forum for Solutions. I'm sure this has been done lots of times before. This search will probably result in forming different questions in your mind. In that case I think you should post a new question in the forum.
 

shutzy

Registered User.
Local time
Today, 12:59
Joined
Sep 14, 2011
Messages
775
i have an audit trail. im not sure if i did it correctly but i created an audit tbl. then on every click of every button i put some code in. to append data to the audit tbl. i did create a log in screen first though. this is recorded too.

its quite a long way to go about it depending on how big your database is but its manageable.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:59
Joined
Jul 9, 2003
Messages
16,286
I don't think the op is ready for audit trail yet.

The op needs to decide on how they are going to record the username.

I think some exploration of the AWF website is required to identify existing solutions.

If they do not understand the solution or they cannot find a solution then the op should make a new post to reflect the fact that the nature of the question has changed.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:59
Joined
Jul 9, 2003
Messages
16,286
As a pointer, I recall that I did a video demonstrating one of the MS Access example databases which saved the user name into a TempVar. Not all versions of MS Access have TempVars so again it is a decision for the op to make before progress can be made.
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:59
Joined
Feb 28, 2001
Messages
27,222
Khalil, this is an OVERVIEW and not intended at this time to be detailed. It will start you thinking about the problem perhaps in a different way than you seemed to be thinking before.

In MS Windows, you have several ways of logging in but they are not always equally secure. That means that using the user name isn't always the right answer even if you think that it is.

If you have a domain-based network in your organization, you log in to the domain using credentials that are harder to fake than if you have a simple stand-alone system that isn't based on domain-level access.

If your user's login name for the domain isn't what you wanted, then your NEXT issue is to determine whether the user must login using a two-part challenge - the username and password challenge for example. You can go through tons of iterations of this process, but eventually you must pick something as the "real" username and go with that. (This is why Uncle Gizmo was hitting so hard on the username.)

When your user uses a login name, there are ways to query the computer for that name involving the Environ function, which lets you look up the computer and user login name.

Next question: Where do you store this name - or any name - that is to be associated with the user for the session? Here is where life gets extremely complicated. Depending on which version of Access you are running, security can become a nasty problem because the older Access security modules based on the MDAC library are no longer in use. Which means if you want to protect your data from what an arbitrary user can do, you can NEVER EVER let the user see tables, queries, or other items in the various navigation panes.

This implies a switchboard or other similar type of opening form that hides everything for you and NEVER closes until the user clicks some sort of EXIT button that causes the application to close. If that is the way you handle it, then you have immediate access to VBA code on the switchboard form's ".FormOpen" event. That is where you can test the Environ function to get information about your environment. Online searches for MS Office and the Environ function should be helpful here.

As to where you store it, it is up to you. For my system, I took the approach of creating a general module dedicated to security functions and subroutines in which I added public variables in the module's declaration area. As long as the switchboard is open, your general modules should stay defined - provided that you are careful with trap handling. A failed trap handler might force you to do a RESET (from the toolbar or a debug dialog box), which would be very detrimental to keeping variables intact.

If you were going to demand a different username than the domain name, the code of the .FormOpen routine is a place where you could fire off an Input Box and put calls to whatever you were going to use to validate that password. (Note that the input box can be told to not echo the input or to echo the input as the * character in case you were using passwords.)

I'd suggest looking into encryption and variations on the Purdy algorithms - which you can lookup online using any intelligent web browser or search engine - because if you are going through the trouble of using some other username than the name used to get into the computer, you are setting yourself up for enhanced security requirements.

This should be enough to get you thinking about the process along the lines that apply to MS Access 2007 and later versions. If you have thought about this already, I'm sorry to have wasted your time - but your comments did not suggest that you had thought about it in this level of detail.
 

JLCantara

Registered User.
Local time
Today, 04:59
Joined
Jul 22, 2012
Messages
335
Hi Khalil!

You will find what you are trying to do in the attached app. Note that I am using alas Access 2013.

The main menu is a dummy to illustrate the log features. You can very easily generalize its utilisation (form usage, rec. mods, etc).

Good luck.
 

Attachments

  • AppUsers.zip
    46.1 KB · Views: 83

Users who are viewing this thread

Top Bottom