Passcode to delete a record
Posted on 2014-02-05
Is there a way have to enter a password in order to delete a record? This password doesn't have to be secure at all (just more of a process). I have using the below code for a password to change an item on this form. If they were to delete the entire record, can I have it ask for the same password (which is the booking number - 111*2)?
Private Sub ItemPrice_BeforeUpdate(Cancel As Integer)
Dim strCorrectPassword As String
strCorrectPassword = Abs(Me.BookNumber - 1111) * 2
If Forms![MainForm]![Bookings subform].Form![DateRecorded] < Date - 1 Then 'Reads in a date field on your from called "Some Date"
If InputBox("Enter Password") <> strCorrectPassword Then 'Compares passwords
Cancel = True
MsgBox "Change not allowed without valid password.", vbOKOnly
Me.ItemPrice.Undo 'undo recent change to this field