Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Changing dataset in Preview Form

edited January 2002 in General
Hi All

I have a custom preview form which is registered with report builder and
is displayed when the print method of the report is called. This is fine.

My problem is that I have added some buttons and other controls to this
form to allow the user to select a different date range, for instance. Once
the user selects the range he presses the refresh button, which causes
the dataset to be re-opened with new parameters (the date range), then
the print method is called again as in this code snippet.

procedure Refresh;
begin
ppReport.Reset;
ppReport.ResetDevices;
Query.SQL.Text := 'select * from blah where date between :d1 and :d2);
Query.Params[0].AsDateTime := somedate;
Query.Params[1].AsDateTime := someotherdate;
ppReport.Print; // where device is set to screen
end;

In fact this code, in theory, could be used to initially display the report
as well
as refreshing the report when the user alters the parameters. However, the
refresh bit doesn't work. All it does is clear the preview panel.

Can anyone explain to me why this doesn't work and is there a workaround
for it.

Btw the custom previewer is shown non-modally.

Oh yeah, for Jim and Nard, I still think report builder is brilliant. Thanks
for
providing us with such a great reporting solution.

Phillip Taylor
Australian Flagship

Comments

This discussion has been closed.