Options

Transferring data from 1 subform to another.

RoelofRoelof Member Posts: 377
HI all,

I have a problem what I would like to fix.

I have created a Service Order with 2 subforms: 1 subform is for the Service Item Lines, the second one is for the Service Invoice Lines. Basically for each Service Item Line you have multiple Service Invoice Lines and both Service Item Linesand Service Invoice Linesare attached to the Service Header. I would like to have a connection between subform 1 and subform 2 so that the Service Invoice Lines are attached to the Service Item Lines, as a 1 to many relationship. It is very hard to transfer variables from 1 subform to another subform. I tried to bring both subforms in a new form as a header with a subform (header = Service Item Line and subform = Service Invoice Line) but when I attach this form to the Service Order form as a subform I get an error which says: 'You cannot call a subform from a subform'. So that doesnt work. Is there a way to fix this problem: to transfer variables from 1 subform to another subform.

Please advise.
Thanks.
Roelof.
Roelof de Jonghttp://www.wye.com

Comments

  • Options
    andreofandreof Member Posts: 133
    It's not the best solution, but you can create a flowfilter and a flowfield in the header table. Then you create a function in subform 1 to populate the flowfilter (ex: get line number). Call the function in activate and deactivate events of subform 1 (dont forget UPDATE). The flowfield makes a lookup to the lines table (document number and line number) and gets the code you want. Filter the subform 2 with the flowfield. This will only work when you activate or deactivate subform 1.
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • Options
    RoelofRoelof Member Posts: 377
    It might partly solve my problem. But I also need to have it activated when I change Service Orders or lines on the Service Item Line subform. Your solution would only work if I click on subform 2, to activate it.
    Any ideas?
    Roelof de Jonghttp://www.wye.com
  • Options
    andreofandreof Member Posts: 133
    You can use a timer to get the subform line No.
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • Options
    RoelofRoelof Member Posts: 377
    Thanks Savatage,
    I'll check it out.

    Roelof.
    Roelof de Jonghttp://www.wye.com
  • Options
    RoelofRoelof Member Posts: 377
    I have a new problem on this issue.
    What happens is that, if I add this code and I run the form, I got an error if I go to a next Header record or create a new Header record. For some reason all filter settings are still there. Which trigger can I use JUST before creating a new record, because the 'OnNewRecord' trigger on the form itself doesn't work.
    By the way, the error says:

    The Service Item Line does not exist:
    Identification fields and values:
    Document Type = 'Order', Document No. = '1234', Line No = 4000.

    The Header filtersettings are correct(doctype and docno). Line No fltersetting is coming from the previous record and I would like to have that reset.

    Every idea or suggestion is welcome.
    Please help.

    Thanks,
    Roelof de Jong.
    Roelof de Jonghttp://www.wye.com
  • Options
    RoelofRoelof Member Posts: 377
    PS: See the website shortcut of Savatage for the Navision code solution. I used that for solving my first problem. But now I have that filter thing problem.
    Roelof de Jonghttp://www.wye.com
Sign In or Register to comment.