Windows Login User - not Database User (1 Viewer)

Local time
Today, 17:52
Joined
Aug 3, 2005
Messages
66
[SOLVED] Windows Login User - not Database User

Hello,

I am successfully using the following AuditTrial, and it works well for my needs:

http://www.access-programmers.co.uk/forums/showthread.php?t=140387

In the field "User" in table "tblAudit", I would like to Log the Windows UserName instead of the Database user.

I am also using the following two modules to get the Windows Username and Computername:

http://www.databasedev.co.uk/get_username_or_computername.html

I am just not sure how to implement "fOSUserName()" into "tblAudit".

Please help.

Thank you kindly.
Jamie.
 
Last edited:

pr2-eugin

Super Moderator
Local time
Today, 16:52
Joined
Nov 30, 2011
Messages
8,494
Is it possible to just show the LOC of the Insert statement, that puts the Database user name into the Audit table? I am just too lazy to download the sample and go through the entire coding to find just that one line.. But if the code is something like..
Code:
INSERT INTO tblAudit(userName, dateModified) VALUES ('" & Forms!FormName!UserNameControl & "', #" & Date & "#)
Then the change would be just replace Forms!FormName!UserNameControl with the Function name..
Code:
INSERT INTO tblAudit(userName, dateModified) VALUES ('" & fOSUserName & "', #" & Date & "#)
 
Local time
Today, 17:52
Joined
Aug 3, 2005
Messages
66
[SOLVED] Windows Login User - not Database User

Thank you pr2-eugin, you pointed in me in the right direction.

In the Module there is actually a " Dim sUser As String" line which I simply changed to:

sUser = fOSUserName

The 'UserField" in 'tblAudit' now gets the WindowsUserName.

Thanks again.
 

Users who are viewing this thread

Top Bottom