Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-14-2018, 03:43 PM   #1
Ossama22
Newly Registered User
 
Join Date: Aug 2018
Posts: 32
Thanks: 1
Thanked 0 Times in 0 Posts
Ossama22 is on a distinguished road
Created by & modfied by

Hello guys ,

Iam just wanna to know if there any VB code can help me with the below :
I have a database shared with my team (8 users) each one have his own username and password , is there any option to add a tool helps me to know this record created by which user , also if it modfied can i knwo it modfied by which one too .
Thx for your support

Ossama22 is offline   Reply With Quote
Old 09-14-2018, 05:32 PM   #2
MarkK
Super Moderator
 
MarkK's Avatar
 
Join Date: Mar 2004
Location: Vancouver BC
Posts: 7,761
Thanks: 10
Thanked 1,287 Times in 1,225 Posts
MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all
Yeah u betcha when u add a new record you just wanna handle the BeforeInsert event, and update the fields yur talking about, like....
Code:
Private Sub Form_BeforeInsert(Cancel as Integer)
   Me.Username = < the username of the current user >
End Sub
So u can see you just wanna replace that bit in blue with the current user's actual username.
Makes a lotta sense?
Mark
__________________
formerly known as lagbolt | Windows 10 | Access 2010 | Visual Studio 2013 | "Institutions have a vested interest in perpetuating the problems to which they are the solution." - Clay Shirky
MarkK is offline   Reply With Quote
Old 09-14-2018, 05:42 PM   #3
jdraw
Super Moderator
 
jdraw's Avatar
 
Join Date: Jan 2006
Location: Ottawa, Ontario, Canada;West Palm Beach, Florida
Posts: 11,616
Thanks: 58
Thanked 1,886 Times in 1,836 Posts
jdraw is just really nice jdraw is just really nice jdraw is just really nice jdraw is just really nice jdraw is just really nice
Re: Created by & modfied by

There is a youtube video here on recording who created or modified a record and when that may be helpful. It uses data macros.

__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
jdraw is offline   Reply With Quote
Old 09-14-2018, 05:44 PM   #4
MarkK
Super Moderator
 
MarkK's Avatar
 
Join Date: Mar 2004
Location: Vancouver BC
Posts: 7,761
Thanks: 10
Thanked 1,287 Times in 1,225 Posts
MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all
Oh yeah, an' sorry 'bout not sayin' how u wanna do the update part, like...
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
   Me.UpdatedBy = < the username of the current user >
End Sub
So u can see it wurks in a lotta ways the same.
Mark
__________________
formerly known as lagbolt | Windows 10 | Access 2010 | Visual Studio 2013 | "Institutions have a vested interest in perpetuating the problems to which they are the solution." - Clay Shirky
MarkK is offline   Reply With Quote
Old 09-14-2018, 07:26 PM   #5
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 12,591
Thanks: 62
Thanked 1,210 Times in 1,110 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: Created by & modfied by

Ossama22 - the first question is not HOW, but WHAT you want to do. IF all you want is the name, date, and update/insert - then putting an event routine for BeforeInsert and BeforeUpdate would work. However, this leads to questions like:

Do you only want to know who inserted it and who LAST updated it? Or do you want a bit more detailed history like - every time it was updated? What about a record deletion (if you allow that at all)?

People sometimes use a separate table to make an audit log. You can search this forum for the word "auditing" and the phrase "audit log" to see MANY articles on the subject.

__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help created new database rvil460 General 16 07-13-2011 03:54 PM
New Files being created bluedigital General 5 11-27-2007 01:12 PM
record just created... agehoops Modules & VBA 6 07-12-2007 10:19 AM
Reports not being created :( Beacher Reports 0 05-13-2005 09:43 AM
[SOLVED] Created a macro in vba help!!! mysteryman101 Macros 1 02-01-2005 02:09 AM




All times are GMT -8. The time now is 05:36 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World