Auto fill Employee field based on logon

P

Petra

What is VB syntax to grab windows login and autopopulate employee field?

Any advice is greatly appreciated...
 
R

Ron Weiner

Get User Name with:

Private Declare Function GetUserName Lib "ADVAPI32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long
Public Function GetUser() As String
' This just gets the name of the user
On Error GoTo Err_GetUser
Dim Username As String * 255
Call GetUserName(Username, 255)
GetUser = Left$(Username, InStr(Username, Chr$(0)) - 1)
Exit_GetUser:
Exit Function
Err_GetUser:
MsgBox Err.Description
Resume Exit_GetUser
End Function

Autopopulate employee field:

?????

Ron W
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top