Re: Trapping Delete in Forms 4.5
Date: 1997/05/01
Message-ID: <862503104.21043_at_dejanews.com>#1/1
In article <01bc55e3$7f38d760$686482d0_at_cbcsf1.techlink.net>,
>I have a simple problem but haven't been able to solve it for 2 hours. How
>do I do the following with a WHEN-REMOVE-RECORD trigger or a KEY-DELREC or
>ON-DELETE trigger, etc. (I am pretty sure that it should be the
>WHEN-REMOVE-RECORD trigger):
>
> When the user presses Shft-F6 to delete a record
> 1. I pup up a Yes/No alert box.
> 2. If the user selects YES then
> I want to delete the record
> Else
> I leave the record intact.
> End if
>The first part (1) works as expected but I can't get part 2 to work
>properly. It seems that the record gets deleted anyway (whether YES is
>selected or NO)... By the way, I do return the value of the alert box
>selection into a variable and use it in my IF statement so that is probably
>not the problem.
>
>Cleve.
The record gets deleted anyway, because the WHEN-REMOVE-RECORD trigger runs when the form has already decided to chuck the record. (It also runs when you scroll up from the last (empty) record in a block.)
You need to do it in the key-delrec trigger. If user answers YES, then do the delete_record command, and don't do it if user answers NO.
HTH,
Steve Cosner
-------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to UsenetReceived on Thu May 01 1997 - 00:00:00 CEST