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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Database Logon Name through VBA 1

Status
Not open for further replies.
Jul 18, 2001
13
US
Hello,
I am using microsoft access 97 with a dedicated workgroup information file. I was wondering id there is any way to retrieve the Logon Name in VBA. It is a knowledge base software, and I'd like for access to automatically fill the userID class so that people will not have to continually enter their user ID when writing new solutions, and so that the field will always be set accurately to whoever submitted the article.

Thanks,
Joe Lindquist
 
well, I've never worked with workgroups, but I usually grab the logon name with this routine. Hopefully it will work for you as well.

Function FIND_USER() As String

On Error GoTo ERR_FIND_USER
Dim UserParam$

UserParam$ = Environ("S_USER")
If UserParam$ = "" Then UserParam$ = Environ("USERNAME")
FIND_USER = UCase$(UserParam$)

EXIT_FIND_USER:
Exit Function

ERR_FIND_USER:
MsgBox Error$
Resume EXIT_FIND_USER
End Function Maq B-)
<insert witty signature here>
 
will still work but you can still make life easier by using

currentuser() where ever u want the current database user to appear
 
joebickley-
That is what I was originally looking for, but Maq's idea returns their Windows Login ID, which is going to work even better.

Thanks, though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top