Copy filters from subform into report

mwilkinsonmwilkinson Member Posts: 7
I have a form that has a subform. I have added a print button to the main form and I want to be able to copy whatever filters that have been set in the subform to the print button so they can be passed to the report.

Is this possible as I can't seem to make it work.

I know I can create the filters manually and pass them to te report, but the problem with this is that I don't know which filters the user will apply so I need to just copy whatever they put on the form to the report.

Many thanks

Matthew 8)

Answers

  • David_CoxDavid_Cox Member Posts: 509
    Create a function on the table or subform , then run your function in the subform, called from the header form!

    Look at the functions on the Line button on a "Sales Order", these call functions on the sales line subform and table, like this

    CurrForm.SalesLines.FORM.OpenItemTrackingLines;

    David
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • mwilkinsonmwilkinson Member Posts: 7
    Thanks for the reply but I'm still confused., as I am relativley inexperienced in development. I looked at the sugestion but it does not make sense to me as I still can't work out how to pass the info over to the report. Maybe if give you a bit more detail it will help.

    I have a form that is based on the Production Order Header and the subfrom is on the production order lines. I want to be able to copy what ever filters have been set on the lines to a report(which is only prod orderlines) that has had a print button added to the Main form.

    Any help will be really apreciated as this is driving me around the bend!!!

    I know I should be able to do it, but can't get there!!!

    Thanks,

    Matthew [-o< ](*,)
  • mwilkinsonmwilkinson Member Posts: 7
    I managed to solve it this way.

    On the subform I created a function with a local varibale of ProdOrdLine that points to the production order Line Table

    ReportFilter()
    ProdOrderLine.RESET;
    ProdOrderLine.COPY(Rec);
    REPORT.RUNMODAL(67108,TRUE,FALSE, ProdOrderLine);

    Then on the Parentform I call this function under the print button

    CurrForm.ProdOrderLine.FORM.PrintReport;

    and bobs your uncle!!!

    Thanks for the initial direction it eventually got my brain working again \:D/ \:D/
  • FrankLFrankL Member Posts: 1
    I had the same Problem today. Thanks for solving!
    :D:D:D
Sign In or Register to comment.