Advice needed... report changes while in previewer
I use a TppDesigner for presenting all reports... The design tab is
available so users can change report layouts... This works really well...
Now I'm using a technique whereby the report data can be changed while the
previewer is open. My question is, how do I regenerate the report and move
to a certain page # within the report?
My code works but I'm getting invalid pointer errors fairly frequently...
Here's my code:
procedure TDMJobListingReport.regDetailDrawCommandClick(Sender,
aDrawCommand: TObject);
var
tmp : integer;
begin
inherited; // the data module containing reports is inherited from a base
data module
tmp := rbDesigner.Viewer.AbsolutePageNo;
// Following form allows user to change data that changes the report...
with TfrmJobPromisedCalendarDataEntry.Create (nil) do
try
if execute (TppDrawCommand (aDrawCommand).Tag)
then
begin
rbReport.Cancel;
// close and re-open the datasets
openPromisedJobsCalendarDataset;
rbDesigner.Viewer.RegenerateReport;
application.ProcessMessages;
if tmp <> 1
then rbDesigner.Viewer.GotoPage (tmp);
end;
finally
free;
end;
end;
In stepping through my code the invalid pointer error happens after the
above procedure has executed, but I'm sure it's something about what I'm
doing in the above routine that is causing the problems...
Any ideas are welcome.
Keith
available so users can change report layouts... This works really well...
Now I'm using a technique whereby the report data can be changed while the
previewer is open. My question is, how do I regenerate the report and move
to a certain page # within the report?
My code works but I'm getting invalid pointer errors fairly frequently...
Here's my code:
procedure TDMJobListingReport.regDetailDrawCommandClick(Sender,
aDrawCommand: TObject);
var
tmp : integer;
begin
inherited; // the data module containing reports is inherited from a base
data module
tmp := rbDesigner.Viewer.AbsolutePageNo;
// Following form allows user to change data that changes the report...
with TfrmJobPromisedCalendarDataEntry.Create (nil) do
try
if execute (TppDrawCommand (aDrawCommand).Tag)
then
begin
rbReport.Cancel;
// close and re-open the datasets
openPromisedJobsCalendarDataset;
rbDesigner.Viewer.RegenerateReport;
application.ProcessMessages;
if tmp <> 1
then rbDesigner.Viewer.GotoPage (tmp);
end;
finally
free;
end;
end;
In stepping through my code the invalid pointer error happens after the
above procedure has executed, but I'm sure it's something about what I'm
doing in the above routine that is causing the problems...
Any ideas are welcome.
Keith
This discussion has been closed.
Comments
work:
procedure TDMJobListingReport.regDetailDrawCommandClick(Sender,
aDrawCommand: TObject);
var
tmp : integer;
begin
inherited;
tmp := rbDesigner.Viewer.AbsolutePageNo;
with TfrmJobPromisedCalendarDataEntry.Create (nil) do
try
if execute (TppDrawCommand (aDrawCommand).Tag)
then
begin
openPromisedJobsCalendarDataset;
rbDesigner.Viewer.RegenerateReport;
application.ProcessMessages;
if tmp <> 1
then rbDesigner.Viewer.GotoPage (tmp);
end;
finally
free;
end;
end;
All I did was to remove the call to rbReport.Cancel and now I no longer get
the invalid pointer errors...