PC Review


Reply
Thread Tools Rate Thread

Accessing UserName via VBA

 
 
John Parker
Guest
Posts: n/a
 
      11th Jun 2004
On a secured database using workgroups, how can I access
the name of the user that is logged on using VBA?
 
Reply With Quote
 
 
 
 
Bruce
Guest
Posts: n/a
 
      11th Jun 2004
I don't remember wher I got this:

In the Declarations section of VBA->

Declare Function GetUserName Lib "ADVAPI32.DLL"
Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long


Then write the function:

Function LogonUserName()
Dim S As String
Dim N As Long
Dim Res As Long

S = String$(200, 0)
N = 199
Res = GetUserName(S, N)
LogonUserName = Left(S, N - 1)


End Function

then:

User_id = LogonUserName
Returns the UserID of the current user..



>-----Original Message-----
>On a secured database using workgroups, how can I access
>the name of the user that is logged on using VBA?
>.
>

 
Reply With Quote
 
Albert D. Kallal
Guest
Posts: n/a
 
      11th Jun 2004
You can use the currentUser() function.


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(E-Mail Removed)
http://www.attcanada.net/~kallal.msn


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When accessing a calendar, I am asked for a username and password Geoff Microsoft Outlook Calendar 0 3rd Feb 2009 06:39 PM
accessing share folder did not ask username Adnan Windows XP General 0 11th Mar 2008 05:36 AM
One username/pw mult machines and accessing files... David Rothman Windows Vista Networking 2 1st Feb 2007 06:57 PM
Prevent Username Accessing Workbook Martin Whitehead Microsoft Excel Setup 1 2nd Apr 2006 12:44 PM
Having trouble accessing a username ( I messed up bad) Brandon Hav Windows XP Accessibility 2 15th Nov 2003 10:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:49 PM.