I have created the following module to populate a form with the users windows login name:
and in the form i have an unbound text box with an event which populates the text box:
I need to be able to have the "windows username" of the person entering the data written to a table but I cannot figure out how to accomplish that...when i change the unbound text box to a bound it gives me an error...can anyone give me any suggestions.
thanks!
Paul
Code:
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 in the form i have an unbound text box with an event which populates the text box:
Code:
User = fOSUserName()
Me.txtusername = Nz(User, "")
I need to be able to have the "windows username" of the person entering the data written to a table but I cannot figure out how to accomplish that...when i change the unbound text box to a bound it gives me an error...can anyone give me any suggestions.
thanks!
Paul