Open Query from Report

Hi Everybody

I design one report from Query with 3 variable :

- Starting Date

- Post Code

- Customer No

On Report I write code

Integer - OnPreDataItem()
  IF  (StartDate=0D) AND (PostCode='') THEN
    BEGIN
      Query_001.SETRANGE(Query_001.No,CustomerNo);
      Query_001.OPEN;
    END ELSE
  IF  (StartDate=0D) OR (CustomerNo='') THEN
    BEGIN
      Query_001.SETRANGE(Query_001.Post_Code,PostCode);
      Query_001.OPEN;
    END;
  IF  (StartDate <>0D) AND (CustomerNo='') AND (PostCode='') THEN BEGIN
       Query_001.SETRANGE(Query_001.Starting_Date,StartDate);
       Query_001.OPEN;
 END;

I do not understand why choosing Customer No and Post Code variables then activity statements, but when choosing the Starting Date variable the report is empty (no record exists).

Please help fix code. Thanks so much

Best Regards,

dinhson

Related
Recommended