Error on Rec delete

ArtursArturs Member Posts: 30
edited 2002-06-07 in Navision Financials
hi

I have problem ... In the OnOpenForm() trigger is needed to delete the active record (Rec). I have done it with DELETE command but on trigger exit it runs error message (There's no such record in the table TTT) and closes the form. However record is deleted from table and on next start of the form everything is ok.
So where's the problem? I tried to use CurrForm.UPDATE after DELETE but nothing changed.
Regards,
Arturs Gedvillo
CTO

Comments

  • goldeneyegoldeneye Member Posts: 14
    Maybe you can try deleting the record through another recordvariable and then use a CurrForm.UPDATE(FALSE);

    Haven't tried it though..
    aka Vincent Vancalbergh

    "I tried filtering life, but the universe returned an Internal Error"
  • pdjpdj Member Posts: 643
    Try and add this line at the end of you OnOpenForm:
    IF FIND('-') THEN;

    I guess it helps, but I doubt it works if it doesn't find any record.

    But doesn't that help for the typical use?

    What about putting this code in the OnFindRecord trigger:
    </font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">
    IF NOT FIND(Which) THEN
    EXIT(FALSE);
    WHILE ShouldBeDeleted THEN BEGIN
    DELETE;
    IF NOT FIND(Which) THEN
    EXIT(FALSE);
    END;
    EXIT(TRUE); </pre><hr /></blockquote><font size="2" face="Verdana, Arial">100% untested, but I hope you see the picture :-)

    The OnNextRecord should maybe also be "wrapped", but it's a bit more tricky. Try that one yourself :-)

    <small>[ 07-06-2002, 11:02: Message edited by: pdj ]</small>
    Regards
    Peter
Sign In or Register to comment.