How do I get the Windows User ID

R

Ray Milhon

I have an unsecured Access 2000 Database. I need to track the user's that
add new and edit old data. (new requirement) I know there is a dll that can
be used to get the Windows User information and I would like to use that to
save the user info. It's been quite a while since I've done that and I've
forgotten the syntax any help would be appreciated.
 
I

IgaJim

Try this:

Function UNameWindows() As String
UNameWindows = Environ("USERNAME")
End Function

another helpful function:
Function TempDirectory() As String
TempDirectory = Environ("TEMP")
End Function
 
D

Douglas J. Steele

I always cringe when someone suggests using the Environ function to retrieve
the user ID, given how easy it is to reset environment variables.

The API approach to which I pointed is almost as simple, and is guaranteed
to be correct.
 

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