Created by & modfied by (1 Viewer)

Ossama22

Registered User.
Local time
Today, 22:54
Joined
Aug 31, 2018
Messages
52
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
 

MarkK

bit cruncher
Local time
Today, 13:54
Joined
Mar 17, 2004
Messages
8,178
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 = [COLOR="Blue"]< the username of the current user >[/COLOR]
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
 

MarkK

bit cruncher
Local time
Today, 13:54
Joined
Mar 17, 2004
Messages
8,178
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 =[COLOR="Blue"] < the username of the current user >[/COLOR]
End Sub
So u can see it wurks in a lotta ways the same. :)
Mark
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 15:54
Joined
Feb 28, 2001
Messages
27,001
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.
 

Users who are viewing this thread

Top Bottom