FILTERGROUP raises an Error (when returning 0 rows)

Hi friends,

I’ve created a tabular form and applying a filter in code:

FILTERGROUP(2);

SETRANGE(“Document No.”, MyVariableWithDocumentNo);
FILTERGROUP(0);

It works normal, but only if there is data afters SETRANGE operation.

For example:

  • SETRANGE(“Document No.”, 5) returns many rows and NO PROBLEM.

  • SETRANGE(“Document No.”, 6) returns zero rows and raises an error.

I need to show an empty form to the user, if SETRANGE returns zero rows. How can I avoid error message?

thanks

What Error is raised?

I use this code quite often and the system usually does not care if there is a record returned or not.
It could be that some additional code somewhere else is failing

Yes, thans for an idea.

found.

A textbox on the form, which contained “Document No.” has a trigger called “OnAfterValidate()”.

That trigger contained a code CurrForm.UPDATE; This was the reason of error.

Problem solved. Thanks.