Hi all,
I'm tracking any changes made to records within the database which includes user name and storing it within an archive table (tbl_Archive)
To track the user name I'm using code I managed to find on this site within a form's module which works a treat and is shown below:
What I'd also like to be able to do is change the names given (which as it's a company computer happens to be an incomprehensibl e set of alphanumerics) to the users actual name so it's easier to understand who made the edit.
As this is going to be a private database with (at present) only a handful of users and the log-on name never changes, I'm guessing there must be a way of changing the names through a module or something.
I tried to create my own like this:
And then placed "UserNames" after the code above but it still came up with the jargon rather than my actual name.
Any help would be much appreciated.
Leigh
I'm tracking any changes made to records within the database which includes user name and storing it within an archive table (tbl_Archive)
To track the user name I'm using code I managed to find on this site within a form's module which works a treat and is shown below:
Code:
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function fOSUserName() As String ' Returns the login name for Adminstrator use Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If (lngX > 0) Then fOSUserName = Left$(strUserName, lngLen - 1) Else fOSUserName = vbNullString End If End Function
As this is going to be a private database with (at present) only a handful of users and the log-on name never changes, I'm guessing there must be a way of changing the names through a module or something.
I tried to create my own like this:
Code:
Public Function UserNames() LK039384 = "Leigh Woodcock" End Function
Any help would be much appreciated.
Leigh
Comment