Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ask for network logon info in VBA 1

Status
Not open for further replies.

Gerbers404

Programmer
Jun 11, 2001
84
0
0
US
Hi there,

I'm wondering if anyone here knows how to prompt a user for their network logon name and password and then verify that those credentials are valid.

I would like to have specific events (button clicks, mostly) in my Access App. prompt the user for their network logon name and PW. If the credentials supplied are not valid, I'd like to be able to capture the errors (wrong user name, wrong PW, etc.), as I will have to assume that no errors would mean that the supplied credentials were correct.

I would think that this would be possible, but haven't had any luck figuring it out to this point. any help would be appreciated.

Thanks.

Gerbers404
 
HitechUser

Thank you very much for this mvps link!

with a few changes, it is now working well, and I'm sure it will be able to work the way I want with a little more tweaking.

Again, I really appreciate this, as I've been struggling for quite a while with this one.

Thanks again!


Gerbers404
 
I am looking for a way in Access to obtain the network logon credentials automatically. Can this be done?
 
Have you tried Environ("UserName") ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Here is a short routine I frequently use.....

Function GetNetworkUserName() As String
' Returns the network login name

Dim lngLen As Long, lngX As Long
Dim strUserName As String

strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
GetNetworkUserName = Left$(strUserName, lngLen - 1)
Else
GetNetworkUserName = ""
End If

'MsgBox "User name is: " & GetNetworkUserName
End Function


Brad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top