Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Pull NT Network ID from an Access Database

Posted on 1999-06-28
Medium Priority
Last Modified: 2006-11-17
Each user in our environment has their own NT login and password.  I'd like to have the database be able to access their NT login (just put it into a variable and manipulate it from there).

We do not have workgroup security enabled, so the currentUser() Function won't work.
Question by:GarrettLang
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Author Comment

ID: 1997707
This is my first time using Expertsexchange, so if I've posted this to an inappropriate room, or mis-valued my post, please feel free to add a comment to the question stating so and I will repost it as appropriate.

Thank you.

Accepted Solution

dapperry earned 400 total points
ID: 1997708
Heres how I do it.  Post this into a module.

Global gCurrentUser As String

'Win API function that gets the current username
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Public Function GetUserInfo()
Dim s As String
Dim cnt As Long
Dim dl As Long

'Get the current username
cnt = 199
s = String$(200, 0)
dl = GetUserName(s, cnt)
If dl <> 0 Then
    gCurrentUser = Left$(s, cnt)
End If
If Mid(gCurrentUser, Len(gCurrentUser), 1) = Chr$(0) Then
    gCurrentUser = Mid(gCurrentUser, 1, Len(gCurrentUser) - 1)
End If


Let me know if you have any questions.

:) dapperry

Expert Comment

ID: 1997709
By the way - Welcome to Experts-Exchange.  Hope your experience will be beneficial.

:) dapperry

Author Comment

ID: 1997710
Thanks for your prompt and helpful response!


Author Comment

ID: 1997711
And thank you for your warm welcome to Experts Exchange.  It looks like it will definately be beneficial :-)

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question