Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 27th, 2006, 07:12 AM
Friend of Wrox
 
Join Date: Dec 2005
Location: CHENNAI, TAMILNADU, India.
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default user log details...

HI all,

  In my database i have three user and i want to know the user log details. Like .. by what time they logged in and what are the things they did like editing the data or adding data soo on ..

 Is this possible guy's ..I heared about this but iam not having vast knowledge...please help me ..



Learn as you can..
------------------------
pap...
Reply With Quote
  #2 (permalink)  
Old November 27th, 2006, 07:22 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: Salisbury, Wiltshire, United Kingdom.
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to leehambly
Default

Pap,

Anything is possible... but unless I missed a meeting, you will have to build this yourself.

I would suggest building a User Table (for your user details), User Trail Table (to store the user actions you want to record) and also a set of forms and a module to administrate the whole thing.

For the User Trail: you are best off using a function to add new trail events. Use the function whenever you come across an event you want to add to the trail. There are no triggers in Access, so you have to build them yourself, essentially.

Frankly, user security and the like are doable in so many different ways in Access, I would suggest a book on the subject.

NB: I DON'T suggest using the Access security features in any way, shape or form.
Reply With Quote
  #3 (permalink)  
Old November 27th, 2006, 09:12 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

   Create a function in a module. Put this code in:

Public Function sU()
sU = (Environ$("Username"))
End Function

   This will pull the username of the person opening the app as they are logged into their workstation.

   On your main form On Load event, put code that takes the current date/time (Now()) and the username from the module Function (sU()) and pass those to a table that has fields named: Username, Login, Logout.

   On your main form On Close event, put code that takes the sU(), then looks up in the table you made for record(s) where Username = sU, and Logout = "". Then push the current date/time to the logout field.

   This will keep a record of the login and logout times by user. You may want to set the table to hidden.

   Let me know if you want to add the following fields to your other tables to track this info:

DateCreated - per record
WhoCreated
DateModified
WhoModified

   These will only keep the name and date/time of the person who created a record, and the last name and date/time of the person who modified the record.

HTH



mmcdonal
Reply With Quote
  #4 (permalink)  
Old November 28th, 2006, 06:18 AM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi Mmcdonal
I have been following this thread and if could advise me how to do the following it would be great

DateCreated - per record
WhoCreated
DateModified
WhoModified
Thanks


Brendan Bartley
Reply With Quote
  #5 (permalink)  
Old November 28th, 2006, 08:21 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Sure. In each table that you want to track these issues, create these four fields:

DateCreated - date/time - default = Now()
WhoCreated - text
DateModified - date/time - no default
WhoModified - text

Put these fields on your form, but make them invisible. At least change them to disabled.

Then on your forms, on the Before Insert insert event, add this code:

Dim sUser As String
sUser = (Environ$("Username"))
Me.WhoCreated = sUser

On the same form's Before Update event, add this code:

Dim sUser As String
sUser = (Environ$("Username"))
Me.WhoModified = sUser
Me.DateModified = Now()

This will track the date and time and who created each record, and the date and time of who LAST modified each record, if they use the form to create and modifiy records.

The only way to track the total modification history is to create a transaction table, and start logging old and new values in that table with this data as well.

HTH


mmcdonal
Reply With Quote
  #6 (permalink)  
Old November 28th, 2006, 12:10 PM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

mmcdonal
Thanks for your reply just one question does the table have to be stand alone.To setup an audit trail is this the case

Thanks

Brendan Bartley
Reply With Quote
  #7 (permalink)  
Old November 28th, 2006, 12:17 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I am not sure what you are asking. The table used to log when users open and close the app should be stand alone. The fields to record who creates and modifies records are part of existing tables where you want to track this, and a transaction table should be stand alone.



mmcdonal
Reply With Quote
  #8 (permalink)  
Old November 28th, 2006, 12:31 PM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks again for your reply I am not sure what the tranaction table is
Thanks

Brendan Bartley
Reply With Quote
  #9 (permalink)  
Old November 28th, 2006, 12:37 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You have to decide what goes into the transaction table.

Like, if you have a table with these fields:

tblName
NameID - PK
FName - text
LName - text

And you want to see who does what in the table, create a form that is unbound, but allows users to create or modify records in this table. Then when a record is modified, let's say, you record this in the tblNameTrans table:

TransID - PK
NameID - copy
FName_Old - old value
FName_New - new value
LName_Old - old value
LName_New - new value
UserName - the user that made the modification
DateCreated - date/time default Now()

For grins, you may want to store the transaction table in a totally different database, and just send the data there on the before insert and before update events of a bound form.

Lots of ways to do this.


mmcdonal
Reply With Quote
  #10 (permalink)  
Old November 28th, 2006, 01:21 PM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Exactly how would you transfer the information to another database
Thanks

Brendan Bartley
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't get Log to write the Log.txt file jnbutler BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 3 July 31st, 2007 04:04 AM
user log on nutrino Classic ASP Professional 1 April 7th, 2006 08:19 AM
AppException Class -Log Error to Event Log bekim BOOK: ASP.NET Website Programming Problem-Design-Solution 7 December 7th, 2004 01:01 PM
Chnaging user details andy11983 Classic ASP Basics 5 April 25th, 2004 01:24 PM
I cannot edit user details hdoldur Classic ASP Databases 0 April 3rd, 2004 10:11 AM



All times are GMT -4. The time now is 08:24 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.