Solved

Login Information

Posted on 1999-01-07
3
131 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month10 days, 1 hour left to enroll

623 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