Problem with subreports

Hello Everyone !

I have a "little" problem with subreports in the newest version of FastReport.

I'm trying to do a report containing one subreport.

For main report I was written ADOQuery1 like this : "select id, field1 from table1"

Field "field1" is placed in MasterData1.

Next, I created subreport with ADOQuery2 : "select id, id_sub, field2 from table2 where id_sub=:id_sub". Parameter :id_sub is linked to field id from ADOQUERY1
Subreport is placed in MasterData1 on maim raport page.

I created 2 example tables :

table 1 :

id field1
1 t1
2 t2


table 2 :

id id_sub field 2
1 1 r1
2 1 r2
3 2 i1
4 2 i2

I was expect, that the result should be something like this :

t1 r1
r2

t2 i1
i2

But I gained :

t1 r1
r2

t2 r1
r2

Any suggestion what I'm doing wrong ?

Best Regards
TK

Comments

  • gpigpi
    edited 7:30AM
    Try to reopen ADOQuery2 in MasterData1.OnBeforePrint event
  • edited 7:30AM
    gpi wrote: »
    Try to reopen ADOQuery2 in MasterData1.OnBeforePrint event
    I have no idea how to do this.. [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> Best regards[/img]
  • edited 7:30AM
    procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
    begin
       TADOQuery2.Close;
       TADOQuery2.Open;
    end;
    

    Where MasterData1 assigned to TADOQuery1.

    Mick
  • edited 7:30AM
    Mick.pl wrote: »
    procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
    begin
       TADOQuery2.Close;
       TADOQuery2.Open;
    end;
    

    Where MasterData1 assigned to TADOQuery1.

    Mick

    That is exactly what I need !!!

    Thank You very much !

    best regards
    TK

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.