Can a user change own password to acess forms

despatcher

Registered User.
Local time
Today, 15:20
Joined
Apr 15, 2006
Messages
20
I have a training db (records personnel qualification states and when they are required to resit tests) that is accessed/viewed by any employee with access to the company network. They can only view the forms as each field is locked out so unable to edit.

Within this db each line manager has a mirror image of the same form controlled by a PASSWORD protected command button so they can go in and update records when required.

the basic makeup of the password side of things is this:

Table containing Password
= tblPassword
COLUMN 1 Name = User Name
Column 2 = keycode

Form to prompt enter password
= frmPassword
Text Box Name = Text0
Cmd Button Name = CheckPassword
On click Event Procedure =
If IsNull(Forms!frmPassword!Text0.Value) Then
MsgBox "You cannot enter a blank Password. Try again."
Me!Text0.SetFocus
Else
MyPassword = Me!Text0.Value
DoCmd.Close acForm, "frmPassword"
End If


Module for On Open event of Form =

Private Sub Form_Open(Cancel as Integer)
Dim Hold As Variant
Dim tmpKey As Long
Dim I As Integer
Dim rs As DAO.Recordset
Dim db As DAO.Database

On Error GoTo Error_Handler
' Prompt the user for the Password.
DoCmd.OpenForm "frmPassword", acNormal, , , , acDialog
Hold = MyPassword
' Open the table that contains the password.
Set db = CurrentDb
Set rs = db.OpenRecordset("tblPassword", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Name
If rs.NoMatch Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![keycode] = KeyCode(Cstr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
End If
End If
rs.Close
db.Close
Exit Sub

Error_Handler:
MsgBox Err.Description, vbOKOnly, "Error #" & Err.Number
Exit Sub
End Sub


WHAT I NEED TO DO

Currently i have been generating the keycode for the line managers by using the immediate window ?keycode("teststring")
i then transfer resulting keycode to keycode for that form in tblpassword

Is there a way of designing a user friendly form (Not immediate window) for the user to change their password themselves and for the resulting keycode to place itself in the tblpassword, keycode column.

This may sound awkward but i quite like the password system as i have set it up because all the db we use are along this line no massive requirement to shut people out of db just specific forms (very trustworthy staff who dont play with my poorly hidden tables and columns)

Sorry very long winded but i am sure someone out there has the solution this forum never lets me down

Thanks in advance:)
 

Users who are viewing this thread

Back
Top Bottom