protecting records

  • Thread starter Thread starter delboy
  • Start date Start date
D

delboy

i want to stop records being overwriten after initially writing although i
might need to alter /delete via password or something??
 
Hi, I'm not sure about a password protection, but if you
want to make sure nothing is deleted by accident, you can
set the form's AllowEdits and AllowDeletions preperties to
False, and so you can view the records (not as you would
get if the DataEntry is set to Yes, but not to change
them.)
If you then need to edit the record, place a command
button on the form, and attach something like this to it's
Event Procedure:
'Code Start
Private Sub EditRecBtn_Click()
If MsgBox("Switch to Edit mode?",vbYesNo, "Please
Confirm") <> vbYes Then Exit Sub
me.AllowEdits = True
End Sub
'Code ends
this should allow, once clicked, to preform data
alterations on the record. it could also be a good idia to
attach something like this to the form's Current event:
'Code starts
Private Sub Form_Current()
me.AllowEdits = False
End Sub
'code ends
so you can only ediot a record if you specifically ask to.
As far as the delete action goes, you could either use
something like this:
'Code starts
Private Sub DeleteRecBtn_Click()
if msgbox("Are You Sure?", vbYesNo, "Please Confirm") <>
vbYes then exit sub
Me.AllowDeletions = True
Me.Delete
End Sub
'Code ends
in this case you should also add Me.AllowDeletions = False
to the form_current eevent,
or you can erase the record directly from the DB, which is
a rather different story, and i don't feel like getting
into it.
HTH,
Ayelet
 
Back
Top