This technique only works if your users are accessing records via a form, and cannot access the table directly.
-- Add a yes/no field to your table. Call this
ProtectFlag
-- Do not include this field on your form, so the users cannot get to it.
-- Set this field to 'True' via the table, on the records which must not be deleted.
-- Add this code to the Delete event of your form:
Code:
If Me.ProtectFlag = True then
MsgBox "You cannot delete this record", vbExclamation
DoCmd.CancelEvent
End If
Now, users will be able to delete records as usual, unless they have your hidden 'ProtectFlag' field set.
Other thoughts ...
-- The 'undeletable' records can now occur anywhere in the table, which may be useful.
-- If you write any queries or VBA code which deletes records, remember to include a test for the 'ProtectFlag' field value in the query or code.
I hope that this helps.
Bob Stubbs