I want to populate the employee_seq field on my form fwith the value returned by the following function.
If I tie the function to an unbound form field it works fine. I need it to be tied to the bound field "employee_seq".
Code:
Function GetUserFullName() As String
Dim WSHnet As Object
Dim UserName As String
Dim TheUser As Object
Dim UserDomain As String
Dim UserFullName As String
Dim fName As String
Dim Lname As String
Set WSHnet = CreateObject("WScript.Network")
UserName = WSHnet.UserName
UserDomain = WSHnet.UserDomain
Set TheUser = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
UserFullName = TheUser.FullName
' GetUserFullName = UserFullName
Lname = Left(UserFullName, InStr(UserFullName, ",") - 1)
fName = Mid(UserFullName, InStr(UserFullName, ",") + 2)
GetUserFullName = fName & " " & Lname
End Function