Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2007

Tip: Looking for answers? Try searching our database.

View the User Name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jone - 27 Dec 2007 19:41 GMT
Hi,
What code do I write when I want to view the current user name?
Because I made my one log-in form and I want that if the user doesn’t put
the correct password then my msg box should show the user name (I mean user
name form the computer not form access
George Nicholson - 27 Dec 2007 19:53 GMT
http://mvps.org/access/api/api0008.htm
API: Get Network UserName

Signature

HTH,
George

> Hi,
> What code do I write when I want to view the current user name?
> Because I made my one log-in form and I want that if the user doesn't put
> the correct password then my msg box should show the user name (I mean
> user
> name form the computer not form access
Klatuu - 27 Dec 2007 20:09 GMT
Paste this code into a standard module:

Private Declare Function GetUserNameA Lib "Advapi32" (ByVal strN As String,
ByRef intN As Long) As Long
Public Function GetUserID()

Dim Buffer As String * 20
Dim Length As Long
Dim lngresult As Long, userid As String

Length = 20

lngresult = GetUserNameA(Buffer, Length)
If lngresult <> 0 Then
   userid = Left(Buffer, Length - 1)
Else
   userid = "xxxxxxx"
End If
GetUserID = UCase(userid)

End Function

Then to get the user id

   Me.txtUserID = GetUserID
Signature

Dave Hargis, Microsoft Access MVP

> Hi,
> What code do I write when I want to view the current user name?
> Because I made my one log-in form and I want that if the user doesn’t put
> the correct password then my msg box should show the user name (I mean user
> name form the computer not form access
Jone - 28 Dec 2007 03:06 GMT
Thanks!

> Paste this code into a standard module:
>
[quoted text clipped - 27 lines]
> > the correct password then my msg box should show the user name (I mean user
> > name form the computer not form access
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.