Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UserName and Passwords

Status
Not open for further replies.

bob120579

Programmer
Feb 9, 2005
42
US
I recently set up security on an Acces Database with about twenty users. I set this up through a workgroup. I did not assign any initial passwords for the users, as I will require them to set their passwords when they initially log in the first time.

What my concern is, is now I need to ensure that all of the users set a password for themselves. Is there any way I can loop through all of the users in the database and maybe assign them to an array so I can check to see what users set passwords? Thanks!
 
Not sure how sophisticated your login form is, but if a user can't bypass the form, and if your form forces them to enter a password, you should be ok.
I assume you do not have an internal table with user information?

I know you can create users in the Workgroup file and set a password, but I don't know if you can read those values.


"Have a great day today and a better day tomorrow!
 

Once a user has opened your db run a sub that would try to open a new connection to the database using his user name and a blank password. Grab the error and make him to enter a password
Code:
Sub CheckUserPassword()
Dim Sec_Cnn As ADODB.Connection
Dim Err_Cnn As ADODB.Error

On Error GoTo Sec_Cnn_Err

Set Sec_Cnn = New ADODB.Connection
With Sec_Cnn
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .Properties("Data Source") = CurrentProject.FullName
    .Properties("Jet OLEDB:System database") = CurrentProject.Connection.Properties("Jet OLEDB:System database")
    .Properties("User ID") = CurrentUser()
    .Properties("Password") = ""
    .Properties("Mode") = adModeShareDenyNone
    .Properties("Jet OLEDB:Engine Type") = 5
    .Properties("Locale Identifier") = 1033
    .Open
    .Close
End With
Set Sec_Cnn = Nothing
Exit Sub

Sec_Cnn_Err:
    For Each Err_Cnn In Sec_Cnn.Errors
    If Err_Cnn.NativeError = -124585838 Then  'Blank Password
        Set Sec_Cnn = Nothing
        Call ForceUserPassword
        DoCmd.Quit
    End If
    Next

End Sub

Sub ForceUserPassword()

Dim Psswrd As String
Psswrd =InputBox("Enter a Password (max 8 characters)"
Psswrd =left(Trim(Psswrd) ,8)
CurrentProject.Connection "ALTER USER " & CurrentUser & " PASSWORD '' " & Psswrd 
MsgBox "Password Changed. Application Quits. Please Re-Logg In"

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top