Password Complexity Requirements

J

Jim Bob

Does Access support any setting to enforce password
complexity requirements? If not, are their any 3rd party
products available to do this? Are there any options to
prevent an Access user from setting their password to an
empty string?
 
L

Leif

I don't know about 3rd party products, but you can define
your own form to enter the password and use VBA to check
for empty string passwords and any other requirements
(such as min. length, digits plus characters, etc.)

The following example checks for a password greater than 0
characters and <= 20 (Access limit). It assumes three
text boxes are in the current form, txtCurrentPassword,
txtNewPassword and txtVerifyNewPassword, and that New and
Verify must match before the change is made.

Private Sub cmdChangePassword_Click()
Dim cnn As ADODB.Connection

On Error GoTo Err_cmdOK_Click

' Verify that the new password matches verify password
If txtNewPassword <> txtVerifyNewPassword Then
MsgBox "New and verify passwords are different.
Try again", vbExclamation, "Password Error"
GoTo Exit_cmdChangePassword_Click
End If

' Verify new password is not empty and <= 20 characters
If Len(txtNewPassword) = 0 Or Len(txtNewPassword) > 20
Then
MsgBox "The new password cannot be empty, nor
greater than 20 characters. Try again", _
vbExclamation, "Password Error"
GoTo Exit_cmdChangePassword_Click
End If

' Try to reset the user's password
Set cnn = CurrentProject.Connection
cnn.Execute "ALTER USER [" & CurrentUser & "] PASSWORD
[" & txtNewPassword & _
"] [" & txtCurrentPassword & "]"
Set cnn = Nothing

Exit_cmdChangePassword_Click:
txtNewPassword = ""
txtVerifyNewPassword = ""
txtNewPassword.SetFocus
DoCmd.Close
Exit Sub

Err_cmdOK_Click:
MsgBox Err.Description
Resume Exit_cmdOK_Click

End Sub
 

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