Solved

Login Information

Posted on 1999-01-07
3
129 Views
Last Modified: 2010-05-03
How can I get the username for the person logged into the server (winnt/win95/win98) from VB? I need to validate the user to allow different levels to access different parts of the program without having them re-login or keeping a password list.
0
Comment
Question by:dtyson010799
[X]
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 Comments
 
LVL 3

Accepted Solution

by:
myqlG earned 50 total points
ID: 1454659
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

and where ever you want to check it (ill use a command button)
Private Sub Command1_Click()
Dim x As String, y As Long
x = Space$(255)
 y = 255
 GetUserName x, y
x = Left$(x, y)
MsgBox x
End Sub

0
 

Author Comment

by:dtyson010799
ID: 1454660
Thanks
That was exactly what I was looking for.
0
 

Expert Comment

by:soyapi
ID: 3360450
Yes! How to validate user so no access deny.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

751 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