HI,
I have a contact details form and on it I have placed an edit button which I only want to be accessed by those who have the admin password. so when clicked on i want it to ask for password and then when entered correctly open the edit contact details form in edit mode for the current record selected in the contact details form. I have tried various bits of code and have the password element working fine but I can either open the edit record form on the first record alphabetically or a blank edit contact form. this is the code I have currently which when the correct password is entered opens a blank edit contact form - Any assistance would be appreciated
Private Sub edit_button_Click()
Dim strPasswd
strPasswd = InputBox("Enter Password", "Restricted Form")
If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Exit Sub
End If
If strPasswd = "Sunshine" Then
DoCmd.OpenForm "edit_contact_form", , , "[Forms]![contact_details_form]" = "Me.Full_Name", acFormEdit
Else
MsgBox "Sorry you do not have access to this form", -vbOKOnly, "Important Information"
Exit Sub
End If
End Sub