Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jalamang Jobarteh
  Where is Jalamang Jobarteh?
 Jalamang Jobarteh
Subject: Trigger fail Error
Thread ID: 143447 Message ID: 143447 # Views: 1 # Ratings: 0
Version: Visual FoxPro 7 Category: Errors & Debugging
Date: Tuesday, August 28, 2007 9:27:56 PM         

I have been working on demonstrating REFERENCIAL INTERGRITY rules with two tables: a parent and child table.

What I am trying to demonstrate is that you cannot delete parent records while there are child records.

I did a form with two buttons; SEARCH on the parent table for a given record and DELETE to delete the record.

I have pasted below the code associated with the DELETE button.
WITH thisform
IF .text2.value != 0
	IF AERROR(5)= 3

** 3 indicates a delete violation for referential integrity

		MESSAGEBOX('You cannot delete parent because the child is alive')

However, if I run the form and click on the button, after the DELETE button I have the error messsage 'Trigger failed'

My aim here is to intercept the above message and give a message for the user and quit the program gracefully.

I would like to point out that Koen gave assistance a couple of days ago which I thought I understood but on implementing it I have realised that I have not solved the problem.

I would be grateful if someone could help me.

I thank you all for your kindness.


Trigger fail Error Posted by Jalamang Jobarteh @ 8/28/2007 9:27:56 PM