Deleting a specific record

R

Roger Bell

Is there any way I can restrict the user from deleting or making any changes
to a specific record in a Data Base.
Many thanks for any help
 
A

Arvin Meyer MVP

Only if you restrict your users to using forms, and hide the tables and
queries from them. This is what you should be doing anyway. If your database
is split (and it should be) hide the database window or the navigation pane
and don't let the user even see that it exists. In the form that displays
your records, lock the controls or the form based upon the criteria that you
want to apply to that user.
 
R

Roger Bell

Thanks for your help Arvin.

Have already done as suggested. It appears that the lock out relates to
every record in the form and that I cannot restrict deletion of just a SINGLE
RECORD.
Is this correct and thanks again
 
J

John W. Vinson

It appears that the lock out relates to
every record in the form and that I cannot restrict deletion of just a SINGLE
RECORD.

Not without some VBA code (which can be evaded if the user is sufficiently
skillful). You could disallow any access to the data except via the form, and
put code in the Form's On Delete event; this code could check the value of a
field which would identify the record (its primary key) and Cancel the event
if the record is the one to be protected.
 
A

Arvin Meyer MVP

To do that, you need to be able to identify the record and possibly the
person you want to keep out. The record can be locked in the Current event
like:

Sub Form_Current()
If Me.txtID = 247 Then
Me.AllowEdits = False
Me.AllowDelections = False
Else
Me.AllowEdits = True
Me.AllowDelections = True
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top