REPORT.RUNMODAL from Form

any1any1 Member Posts: 7
Hi,

I've build a table and according to that table i got a form and a report.

When i opened the form watching a record, i want to run a report using the current record which is currently displayed in the form.

Function on the form:

Report.Runmodal(12345,False,False,Rec).

When running into the report the rec is lost.
What is wrong here?

Tried putting a SETRECFILTER in front of the Report.Runmodal, but that doesn't help either.

Thanks for any advice.

Greets

Comments

  • KYDutchieKYDutchie Member Posts: 345
    Hi,

    Are you using the Rec from the form?
    If so, just before calling the report try to read your form record into a variable and call the report using the new variable.

    Something like this:

    NewRecVar type Record and should be the same as the source table of your form.

    In Code:
    IF NewRecVar.GET(rec.'First Key',rec.'Second key'....rec.'last key') THEN
    Report.RunModal(12345,False,False,NewRecVar);

    Maybe this will help

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • any1any1 Member Posts: 7
    Tried that, also no success.
    What ive tried so far:

    SETRECFILTER;
    REPORT.RUNMODAL(12345,False,False,Rec)

    === no success

    Rec2 := Rec,
    Rec2.SETRECFILTER;
    Report.Runmodal(12345,False,False,Rec2);

    === no success

    Rec2.Get("No.");
    Rec2.Setrecfilter;
    Report.Runmodal(12345,False,False,Rec2);

    === no success either

    In all cases the record in the report is empty again...
  • garakgarak Member Posts: 3,263
    RecVariable.setrange(YourField,Yourfield);
    report.runmodal(xxx,true,true,RecVariable);
    
    Do you make it right, it works too!
  • any1any1 Member Posts: 7
    Ive done everything from the scratch again.
    Now it works #-o

    I still dont see any difference when comparing the text-files in beyondcompare.

    Using the usual Setrecfilter and running the report with current rec.

    Absolutely no clue what changed, prolly it works only after 10p.m. or something similar, hehe.

    Weird Navision :-)

    Thanks for ur help .
  • SavatageSavatage Member Posts: 7,142
    for example if I wanted to run a report from my puchase order I would do something like this

    PurchLine.RESET;
    PurchLine.SETRANGE("Document Type",PurchHeader."Document Type");
    PurchLine.SETRANGE("Document No.",PurchHeader."No.");
    REPORT.RUNMODAL(50065,TRUE,FALSE,PurchLine);

    try setting the range

    **edit ** oops a bit slow clicking the post button
  • garakgarak Member Posts: 3,263
    yes sava, i was a little bit faster ;-)

    @any1: Please write [solved] infront of your subject in your first post if your question is answered.
    Do you make it right, it works too!
Sign In or Register to comment.