Protect a field from deletion

A

Ann Shaw

Hi whoever can help!

I have a table with the following:

Prod ID - Primary Key
Prod Name
Desc

Also

Order ID - Primary Key
Qty
Date
Lookup to Prod Name

I have found that if there are no orders in for a certain
product, then I can delete the product from the table even
with the relationship (one to many) If there is an order
in I cannot. How can I get it to stop the deletion if
there is no order in place.

Thank you in advance

Ann (Ireland)
 
R

Rick B

You can't if you have delete permission. Anyone who does not have
permission to delete records would not be able to do so.

If your users primarily work from forms (instead of directly from a table)
you could code it so that deletions could not be done there.


Rick B


Hi whoever can help!

I have a table with the following:

Prod ID - Primary Key
Prod Name
Desc

Also

Order ID - Primary Key
Qty
Date
Lookup to Prod Name

I have found that if there are no orders in for a certain
product, then I can delete the product from the table even
with the relationship (one to many) If there is an order
in I cannot. How can I get it to stop the deletion if
there is no order in place.

Thank you in advance

Ann (Ireland)
 
A

Ann Shaw

Hi Rick

Thanks for your reply. I don't understand what you mean
by Delete Permission??

I just don't want anyone using the database to be able to
delete one of my products if there is no order placed.

Thanks

Ann (Ireland)
 
R

Rick B

If you have set up user-level security, then you can go in and give people
access to delete data from a particular table. You can also take that away.

There is no way to simply not allow deletes from a table in general. What
if you make a mistake? What if you make a duplicate table entry? What if
you have old entries that someday do need to go away?

Rick B


Hi Rick

Thanks for your reply. I don't understand what you mean
by Delete Permission??

I just don't want anyone using the database to be able to
delete one of my products if there is no order placed.

Thanks

Ann (Ireland)
 

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