Same User for Win XP and Access 2000

G

Guest

This is reference to a question posted earlier.

Actually I have made 3 users in Windows XP Professional AND with the same
name & password I have made 3 users in Microsoft Access.

Generally I log in by any of the Windows XP user.

Is there any possiblity that I can retrieve the Win XP user name and
password and use the short to open the Mdb as follows :

C:\....Access.exe "C:\Datamdb \Users WinXPCurrentUser \PW WinCurrentUserPW

the above line i found in a book. I know the above is not correct. But I
have written above to make better understand my need that I want to use the
same Operating system current user name &Pw ,for Access so that I dont have
to type again and again.

Regards.

Irshad


==============
 
G

Guest

Hi Irshad,

While you can retrieve the NTUserID, I do not believe it is possible to
retrieve the password. That would be a big security risk. And, even if you
retrieve the NTUserID, it wouldn't be so easy to stick that value into a
shortcut. Why burden yourself with Access security? It's really not all that
secure.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

:

This is reference to a question posted earlier.

Actually I have made 3 users in Windows XP Professional AND with the same
name & password I have made 3 users in Microsoft Access.

Generally I log in by any of the Windows XP user.

Is there any possiblity that I can retrieve the Win XP user name and
password and use the short to open the Mdb as follows :

C:\....Access.exe "C:\Datamdb \Users WinXPCurrentUser \PW WinCurrentUserPW

the above line i found in a book. I know the above is not correct. But I
have written above to make better understand my need that I want to use the
same Operating system current user name &Pw ,for Access so that I dont have
to type again and again.

Regards.

Irshad
 
J

Jan Broeks

I'm used to do as follows to get the Windows username:
It works in Access2 to 2003

Put the first line in the declaration section of a Access Module to
activate the DLL:
Public Declare Function TSB_API_GetUserName Lib "advapi32.dll" Alias
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

And put this function in the same module to retrieve the loggedin
user:
Function GetUserName_TSB() As String
' Comments : Retrieves the name of the user logged into Windows
' Parameters: none
' Returns : string user name
'
On Error GoTo Err_GetUserName_TSB
Dim lngLen As Long
Dim strBuf As String

Const MaxUserName As Integer = 255

strBuf = Space(MaxUserName)

lngLen = MaxUserName

If CBool(TSB_API_GetUserName(strBuf, lngLen)) Then
GetUserName_TSB = Left$(strBuf, lngLen - 1)
Else
GetUserName_TSB = ""
End If

Exit_GetUserName_TSB:
Exit Function

Err_GetUserName_TSB:
MsgBox Err.Description
Resume Exit_GetUserName_TSB

End Function

You can put the username on the systemopening form:
Forms!Menu!userT = GetUserName_TSB()
or put it in a global variant to use all over your application and
check for instance in a table what kind of auhotisation the user was
given.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top