Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RI Messages
Message
From
13/08/2003 18:10:52
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
13/08/2003 16:05:58
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00819926
Message ID:
00819960
Views:
9
>If I setup RI for a field so that deletion is restricted, when a user tries to delete a parent record for which multiple child records exists, he gets an error.
>
>"Unable to commit changes- delete trigger failed"
>
>This is exactly what I want to happen, except i would like to display a friendlier message that would make sense to the ordinary user.
>
>How can I display my own message instead?

I created a standard function, CanDelete() or something, that checked the child records according to the RI-information. Unfortunately, I can't locate the function right now.

The basic idea is to get the RI-information with the function ADBOBJECTS(), parameter "RELATION", to get a cursor with relations.

The function should be invoked before the TableUpdate().

The corresponding error message might read something like: "I can't delete that record, because there are related records in table (Tablename)."

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform