Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User identification 1

Status
Not open for further replies.

Katana2003

Programmer
Jun 25, 2003
23
GB
I am currently creating a user front end for an estimating system that creates standard quotes. On the bottom of every quote that is created there is a signed by. I am looking to pick up the name of who ever is logged in on the machine is this possible. If so I am open for any suggestions on the code.

 
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

'''''''''''''''''''''''''''''''''''''''

Dim st As String
Dim slCnt As Long
Dim slDL As Long
Dim slPos As Single
Dim slUsername As String

' Getusername
slCnt = 199
st = String(200, 0)
slDL = GetUserName(st, slCnt)
slUsername = Left(st, slCnt) & slCnt
slPos = InStr(1, slUsername, Chr(0))
If slPos > 0 Then
With txtUserName
.Text = "" & slUsername
End With
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top