Question Capturing and saving the user name who created and updated a record (1 Viewer)

.Al

New member
Local time
Today, 10:20
Joined
Jun 21, 2012
Messages
2
I hope you are all having a good day.

I've been trying to get this to work but without success. :banghead:

I have taken the Access Tasks template and modified a bit. It now captures and saves the time and date a record is modified. The database is on a network folder and is shared among our team users.


What I would like to do next is make it,

1- capture and record on my Tasks table the user name of who created the record by using the fOSUserName() function. I have the table fields "Created by" and the VB code in a module. This would happen only once when the record is created.

I would also like to do this with the machine name for which I have the module too. fOSMachineName()

and,

2- capture and record the user name of who modified a record. For this I also have a field in my task table "Last Modified By" and i hope i can use the same fOSUerNmae() function.


I have been trying this for the last few days and I just can't. :(

I got to the point where I put an unbounded text box with the =fOSUserName() in it and it does show the user name but how do i get to record to my task table?


Also, do you see how the template removes the tasks that are completed from the task list as soon as it is updated to completed? how can I make this happen with a cancelled option after I add it to the drop down list?


Please help me :eek:
 

Attachments

  • Todays Tasks.accdb
    1.7 MB · Views: 111

JLCantara

Registered User.
Local time
Today, 10:20
Joined
Jul 22, 2012
Messages
335
Hi Al,

Here is the solution; in the default value of your fields enter:

Environ("computername")
Environ("username")

Good programming,
JLCantara.
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 03:20
Joined
Jan 20, 2009
Messages
12,866
The environment variables are not a very secure way to do this since they can be modified by the user.

Better to use these.

Code:
Public Function LoginName()
 
    LoginName = CreateObject("wscript.network").UserName
 
End Function
 
Public Function ComputerName()
 
    ComputerName = CreateObject("wscript.network").ComputerName
    
End Function
 

Users who are viewing this thread

Top Bottom