Auto populate computer user

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?
 
D

DStegon via AccessMonster.com

Do they have to "log in" to the system where you store a Public "CurrentUser"
variable? Do they always use the "same" computer when they log in? You
could grab the computer name and then have a table of users/computers that
you could compare and when populating the combo box set the value to the
value of the user. Somehow you have to "catch and hold" the user, either
though computer name/user or through a program log in.
 
L

LeeTV

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
 

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