I have a command button set up on my form that will delete the current record. I have a box that pops up and asks for a password.

I would like if the incorrect password is entered a message to say "you are not authorized to perform this function".

It is also deleting automatically after the correct password is entered and then the box pops up to confirm deletion (after record is already deleted).

I want a user to enter the password and then be asked to confirm deletion, click on yes and then the record delete.


Below is the code I have:

Private Sub Command493_Click()
On Error GoTo Err_Command493_Click
If InputBox("What's the Password?") = "secret" Then
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70


DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
Exit_Command493_Click:
Exit Sub
Err_Command493_Click:
MsgBox Err.Description
Resume Exit_Command493_Click

End Sub