hardhitter06
Registered User.
- Local time
- Today, 11:27
- Joined
- Dec 21, 2006
- Messages
- 600
HI,
I set up a password on a delete record button to ensure the end user knows they are about to delete a record. I used the password "delete".
So when I hit the delete button at this moment, a password prompts the user and if they type "delete", a message box displays saying something along the lines of "are you sure?"
The problem is, when I hit No, I receive a debug error at the highlighted line...I'm wondering why? Do I need another piece of code to handle the "No"?
I set up a password on a delete record button to ensure the end user knows they are about to delete a record. I used the password "delete".
So when I hit the delete button at this moment, a password prompts the user and if they type "delete", a message box displays saying something along the lines of "are you sure?"
The problem is, when I hit No, I receive a debug error at the highlighted line...I'm wondering why? Do I need another piece of code to handle the "No"?
Code:
Dim strPasswd
Dim stDocName As String
Dim stLinkCriteria As String
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 = "delete" Then
DoCmd.RunCommand acCmdSelectRecord
[B] [COLOR="Yellow"]DoCmd.RunCommand acCmdDeleteRecord[/COLOR] [/B] Else
MsgBox "Sorry, you do not have access to this form", _
vbOKOnly, "Important Information"
Exit Sub
End If