Restricting delete record in a form

W

Wylie C

I have a form which is using a table as the source data. One record in the
table contains the number 0 and the second record the number 1. Users can add
records to the table but I don't want them to delete either of these values.
Can I protect the values in the form and the table as well? The table name is
Routes and the field is RouteNum.

Thank you.
 
J

John Vinson

I have a form which is using a table as the source data. One record in the
table contains the number 0 and the second record the number 1. Users can add
records to the table but I don't want them to delete either of these values.
Can I protect the values in the form and the table as well? The table name is
Routes and the field is RouteNum.

Thank you.

You can (and probably should) set the AllowDeletes property of the
form to True; this will prevent deletion from the table altogether.

A sneaky way to protect these two records is to create another table
with one numeric field (of the same datatype as this one); make this
field its Primary Key, and add two records, 0 and 1. Create a
Relationship from your table to this table, joining primary key to
primary key - a one to one relationship. You don't need any additional
records; a one to one is more precisely a one-to-(zero or one)
relationship. Hide this other table. These two records will not be
deletable, since it would violate the referential integrity.

John W. Vinson[MVP]
 

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