motoxracer400f
Registered User.
- Local time
- Today, 10:19
- Joined
- Feb 14, 2008
- Messages
- 11
Hi,
I am using the the following code to get the windows user name:
and this code to put it in a text box on my form on load:
How do I store the user's name (only when it is created) in my main table. I have a User Name text box on my form that is linked to my "User Name" column in the table. I am able to get it to stamp each record with the user name but if someone else views that record, it overwrites the original user stamp with the current one. I only want the original persons name that created the record to be stored.
Can anyone please help?
--Thanks
I am using the the following code to get the windows user name:
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 network login name
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
and this code to put it in a text box on my form on load:
Code:
Call fOSUserName
UserNameTXT.Value = fOSUserName
How do I store the user's name (only when it is created) in my main table. I have a User Name text box on my form that is linked to my "User Name" column in the table. I am able to get it to stamp each record with the user name but if someone else views that record, it overwrites the original user stamp with the current one. I only want the original persons name that created the record to be stored.
Can anyone please help?
--Thanks