Changing passwords

ellenr

Registered User.
Local time
Today, 11:17
Joined
Apr 15, 2011
Messages
400
I am using ODBC tables as backend for organization's Access 2010 database. I have passworded the entry form for the treasurer's data.

Code:
Private Sub Form_Open(Cancel As Integer)
Cancel = (InputBox("Password?") <> "xxxx")
    DoCmd.Echo False, ""
    DoCmd.GoToRecord acForm, "FinAccount", acNewRec
    DoCmd.Echo True, ""
End Sub

What is the easiest way to set up a little form for the president of the org. to use to change the password when treasurers change?
 
If you hard code it, youll have to maintain it. This is why I use Windows Login Authentication.
Let windows handle the userIDs, passwords, password changes.
You just have to know if Windows says its correct.

Code:
SUB btnLogin_Click()
Dim sUser As String, sPass As String, sDom As String

sUser = txtUser
sPass = txtPass
sDom = txtDom

If WindowsLogin(sUser, sPass, sDom) Then
   mbSafe = True
   DoCmd.OpenForm "frmMainMenu"
   DoCmd.OpenForm "frmLogin"
   DoCmd.Close
Else
   MsgBox "LOGIN INCORRECT", vbCritical, "Bad userid or password"
End If

'-----------------
Public 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
 

Users who are viewing this thread

Back
Top Bottom