Auto populate computer user

  • Thread starter Thread starter grant S
  • Start date Start date
G

grant S

Hi,

I want to auto-populate the user in a subform to avoid the user having to
type this in and/or chose from a drop down list.

Any ideas?
 
Hi,
I use a function call ap_getusername()
I think I obtained it off the newsgroup at one point.
copied and pasted below:
Lee

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


Function ap_GetUserName() As Variant

Dim strUserName As String
Dim lngLength As Long
Dim lngResult As Long

'-- Set up the buffer
strUserName = String$(255, 0)
lngLength = 255

'-- Make the call
lngResult = wu_GetUserName(strUserName, lngLength)

'-- Assign the value
ap_GetUserName = Left(strUserName, InStr(1, strUserName, Chr(0)) - 1)

End Function
 
Back
Top