Refertential Integrity

  • Thread starter Thread starter FP
  • Start date Start date
F

FP

I have enforced Referential Integrity on my tables which
works fine.I have a Main form where I view the data from
the table1(the one with Primary Key) and a subform(the
one which ontains foreign keys) and the form is setup in
datasheet view.When I delete records from the main form I
get the Microsoft Access default Message that "The
Records cannot be deleted since there are related records
in the other tables". I want to include my defualt
message instead of Access message?

How do i trap this messge and have my own one?

Thanks
 
How do i trap this messge and have my own one?

Easy method: use the Form_Error event and look for the Error number.

"Proper" method: manage the delete process, and look for existing child
records first (for example: use DCount function) and either ask the user
for confirmation (you are about to delete 235 records: are you sure? y/n)
or just delete them silently and let the process succeed.

Hope that helps

Tim F
 
Back
Top