KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a an Access App that requires the user to enter their Windows domain user and password to enter. I have used the following VBA code to accomplish this: Function WindowsLogin(ByVal strUserName As String, ByVal strpassword As String, ByVal strDomain As String) As Boolean 'Authenticates user and password entered with Active Directory. On Error GoTo IncorrectPassword Dim oADsObject, oADsNamespace As Object Dim strADsPath As String strADsPath = "WinNT://" & strDomain Set oADsObject = GetObject(strADsPath) Set oADsNamespace = GetObject("WinNT:") Set oADsObject = oADsNamespace.OpenDSObject(strADsPath, strDomain & "\" & strUserName, strpassword, 0) WindowsLogin = True 'ACCESS GRANTED ExitSub: Exit Function IncorrectPassword: WindowsLogin = False 'ACCESS DENIED Resume ExitSub End Function I notice that sometimes when the information is entered correctly, access is denied. I tried to debug once and it gave the error: "The network path was not found. " on the Set oADsObject = oADsNamespace.OpenDSObject) line. Not sure why this occurs sometimes. Is it better to convert to LDAP instead? I have tried but can't construct the LDAP URL correctly.
Tags (comma-separated)
Save Edits
Cancel