Run a report with the current record in form

Stan09
Stan09 Member Posts: 63
Hi,

i try to run a report from a form, the form sourcetable and the report main dataitem are the same. i used Report.Run(...,Rec) in the Command Push trigger. the matter is that the report do not run with the current record of the form but with the random record in the table.

HAve any idea, please share with me.

Answers

  • SPost29
    SPost29 Member Posts: 148
    Stan,
    Reports are run with the filters on rec not the value of rec.
    You need to set a filter on rec equal to the primary key values of rec
    Use:
    myrec local variable same as rec
    myrec.setrange(field1,rec.field1);
    myrec.setrange(field2,rec.field2);
    (etc, if needed)
    report.run(....myrec);

    Steve
  • Stan09
    Stan09 Member Posts: 63
    You are GREAT, Steve
    TKs U.
  • ceismail
    ceismail Member Posts: 2
    It gives an error when use like this : REPORT.RUN(90028,g_changerequest ); The error is "İnvalid type Boolean := Record"
  • 4388331
    4388331 Member Posts: 2
    Stan,
    REPORT.RUN function have next sintaxis:
    REPORT.RUN(Number [, ReqWindow] [, SystemPrinter] [, Record])

    for your report it will be:
    REPORT.RUN(90028,TRUE,FALSE,g_changerequest);
  • ceismail
    ceismail Member Posts: 2
    Thanks, its working.