Cascading Delete Warning

S

Steve D

Hi,
I have a database with a relationship set with cascading deletes. I do
not like the standard warning that pops up when deleting a field in the main
table. Is there a way to create a custom warning that is more explicit for
what the user is about to do by deleting what appears to be one record?
 
D

Dale Fye

Are you actually giving people access to your tables, or are they deleting
from a form?

If you are letting people work directly in your tables, you are making a
huge mistake!

If from a form, you could check to see whether there are records in the
child table that are linked to the record in your main form (Use DCOUNT with
the appropriate criteria). If so, you could display your own custom message
advising them that the record they are about to delete has related records in
one or more other tables, and ask them to confirm the delete operation. Then
use the currentdb.execute method to run a SQL action query that deletes the
record. This particular method supresses warning messages.
 
S

Steve D

For right now it is my database but it is intended to be something that would
be handed down to my predecessor, my boss would also have access to the
tables. I want to make sure anyone who may take over the database in the
future knows the perils of what they may be doing.
 
D

Dale Fye

Unfortunately, Access tables do not have events associated with them, so if
you are working in tables or queries and delete a record, you will get the
standard Acces warning messages, and that is it!

Forms and controls, on the other hand, have events which you can use to
provide feedback to your users when they are about to do something which they
might regret. I've been using Access for 15 years, and I rarely work
directly in tables. I strongly recommend that you document your database
well (a very thorough users manual) if you are not going to build a user
interface for your data, because whoever follows you is bound delete some
critical data.

BTW: Backup/Backup/Backup!
 

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