Passwords, Network User Name

  • Thread starter Thread starter ngoforth
  • Start date Start date
N

ngoforth

Guest
Twi questions, sorry if they're a bit obvious.
1. How can I get a password control for Access 2000 so that users can't see the passwords as they are being entered?
2. Is it possible to pick up the network user name of the current user? The network is ruuning on a windows 2000 server and the local machines are using windows 98.
Thanks very much
Nick Goforth
 
ngoforth,

Actually, the standard Textbox control in access already provides the functionality you need. Set the InputMask property for your password box to the value 'Password'. The textbox will then display * characters instead of the actual password being entered.

As to how to pick up the current UserName from the system, you can use some code to get the information from windows via API calls...

__________________________________________

Private Declare Function API_GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Private Declare Function API_GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long


Public Function GetWinComputerName()
    Dim strBuf$, lngSize&, lngReturn&
    lngSize = 255
    strBuf = String(lngSize, " ")
    lngReturn = API_GetComputerName(strBuf, lngSize)

    strBuf = Left(strBuf, lngSize)
    GetWinComputerName = strBuf
End Function

Public Function GetWinUserName()
    Dim strBuf$, lngSize&, lngReturn&
    lngSize = 255
    strBuf = String(lngSize, " ")
    lngReturn = API_GetUserName(strBuf, lngSize)

    strBuf = Left(strBuf, lngSize - 1)
    GetWinUserName = strBuf
End Function

__________________________________________

Place the above code in a module in your database, and you can then call the GetWinUserName() function to get the username from the system. I have also included the GetWinComputerName() function which will return the Computer Name for the users pc. This code works fine on Win98 and NT4. I havn't tried it on 2000 but it should work on that as well.

Hope that helps.

axa

[This message has been edited by axa (edited 11-19-2001).]
 
Thanks very much for that it works fine. Can't believe that I missed the password property. Still you can't make anything fool proof as fools are so damn ingenious.
Thanks
Nick G
 
You might be able to get the username using Environ$("User"),Environ$("Username")or Environ4("Logname"). You can also find the computer name etc. using Environ$("Cname"). There are lots of environment settings that you can find out using environ. If you use Environ(<n> ) and increment n by 1 you should be able to find all that available on your Network Setup.
Hope that this is usefull.

SC.
 
Thanks very much for that. I haven't had chance to try it yet but it looks as if it should work.
Thanks
nick G
 

Users who are viewing this thread

Back
Top Bottom