Close Report if no data is returned
Andre
South Africa
Hi
I'm using an internal IBXQuery. When the reports starts a Dialog is displayed with two date combo boxes. The start and end date is selected from the drop downs. The report then returns the records between the two selected dates. If there are no records the message is displayed. But the report still shows after setting the page.visible := false,
How can I close the report when there is no data returned in the query ?
I'm using an internal IBXQuery. When the reports starts a Dialog is displayed with two date combo boxes. The start and end date is selected from the drop downs. The report then returns the records between the two selected dates. If there are no records the message is displayed. But the report still shows after setting the page.visible := false,
How can I close the report when there is no data returned in the query ?
procedure Button1OnClick(Sender: TfrxComponent);
begin
  IBXQuery1.Close;                                 Â
  IBXQuery1.ParamByName('StartDT').Value := datetostr(StartDate.Date);
  IBXQuery1.ParamByName('EndDT').Value := datetostr(EndDate.Date);
  IBXQuery1.Open;
end;
procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
    if IBXQuery1.RecordCount = 0 then
  begin
    ShowMessage('Nothing to Print');
    Page1.Visible := False;                                                                   Â
  end; Â
end;
Comments
It works like a charm !
Cheers
Andre