Currreport.QUIT

BeliasBelias Member Posts: 2,998
I'm using quit function after prompting the user to continue or abort the execution of the report
If not confirm(text) then
  currreport.quit
I wrote this code in the onprereport trigger but appears that nav continue the execution anyway...(e. g. it opens a dialogbox)
BTW, nothing is printed.
I read the help but this thing is not mentioned (I think nav continues executing the onprereport trigger and after that aborts the execution)
Can anyone explain this to me?

Thanks in advance...
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog

Comments

  • BBlueBBlue Member Posts: 90
    Why not use ERROR function to abort execution of the code depending user's chice. You can place this in OnPreReport trigger:
    If not confirm(text) then 
      ERROR('You cannot continue!');
    
    //Bogdan
  • BeliasBelias Member Posts: 2,998
    Yes, surely I can do that...BTW I solved my problem...
    Now I would like to know why it happened...thank you BBlue
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • BBlueBBlue Member Posts: 90
    Just out of curiosity, I made a small test on a report and put in OnPreReport (after this there were other code lines in OnPreReport):
    IF NOT CONFIRM('Continue?',TRUE) THEN
      CurrReport.QUIT;
    

    I set a breakpoint and ran the report. If I choose "No" on the above, the report kept on processing the code after the above but stopped when having finished OnPreReport trigger.
    //Bogdan
  • BeliasBelias Member Posts: 2,998
    yes! you're right!it happened to me too...debugging the code, nav processes the whole onprereport trigger and after that it quits!
    strange indeed... :-k
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • afarrafarr Member Posts: 287
    Note that if you want to close a report without showing the request form, you could use the following code in OnInitReport:
    (This is related to the posts above, although I realise that those are about closing the report *after* the request form has run.)
    CurrReport.USEREQUESTFORM := FALSE;
    CurrReport.QUIT;
    
    For some reason, CurrReport.QUIT on its own doesn't work, and RequestOptionsForm.CLOSE also doesn't seem to have any effect.

    See also my post at http://www.mibuso.com/forum/viewtopic.php?f=5&t=29159
    Alastair Farrugia
Sign In or Register to comment.