You can use the procedure below to grab the computer name or the users network login.
Jim.
Private Declare Function GetComputerNameA Lib "kernel32" (ByVal lpBuffer As String, nSize As Long) As LongPrivate Declare Function GetUserNameA Lib "advapi32.dll" (ByVal lpBuffer As String, nSize As Long) As LongPublic Function WhoAmI(bReturnUserName As Boolean) As String ' Function returns either user name or computer name Dim strName As String * 25510 If bReturnUserName = True Then20 GetUserNameA strName, Len(strName)30 Else40 GetComputerNameA strName, Len(strName)50 End If60 WhoAmI = left$(strName, InStr(strName, vbNullChar) - 1)End Function
I already have code to grab the computer name and network username. I'm trying to find a way to have it sync or verify their password when they log into the database against AD. Instead of having separate passwords for AD and the Access DB I want them to be the same but controlled by AD.
<<I'm trying to find a way to have it sync or verify their password when they log into the database against AD. Instead of having separate passwords for AD and the Access DB I want them to be the same but controlled by AD. >>
But if their logged into the computer, then they've already authenticated with AD and all you need to do is grab the network name.
If your saying though that you want to have a situation where user A is logged in, but user B sits down and fires up your app and enters a username/password, and authenticate that, then I don't know how to do that off-hand. It's just never come up before.
I understand what you're saying. So if a user already authenticates with AD there is no need for them to enter a PW when accessing the DB, correct? Right now I have a login form that is bound to a table in my DB where the username and PW are stored. So would I not need to use that table?
Thank you for the detailed explanation Jim. I agree with you about using #2 as the viable option. Thank you again for your help!
Microsoft Access
Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.
Jim.
Open in new window