Dbyte
Technical User
- Mar 6, 2002
- 87
Am trying to have a textbox on my form auto-populate with the ID of the user currently logged onto the PC when the form is opened. I created a module w/ the following code from faq702-4949:
I have a textbox in my form w/ the following in Before Update:
The text box is blank when I view the form.
Code:
Public Function GetUserName_TSB() As String
On Error GoTo error_handler
Dim lngLen As Long
Dim strBuf As String
Const MaxUserName = 255
strBuf = Space(MaxUserName)
lngLen = MaxUserName
If CBool(TSB_API_GetUserName(strBuf, lngLen)) Then
GetUserName_TSB = Left$(strBuf, lngLen - 1)
Else
GetUserName_TSB = ""
End If
Exit Function
error_handler:
Error_Recorder
End Function
I have a textbox in my form w/ the following in Before Update:
Code:
GetUserName_TSB ()
The text box is blank when I view the form.