Options

Update Forms

SeppeSeppe Member Posts: 14
Hi all,

I have 2 different forms, form A and Form B. On each form I have a control. Form A -> "Reference Date", on Form B -> "New Date". When I open Form A, Form B opens automatically and the 2 controls are filled with the workdate.
Is it possible -and if so, how- to change the control "New Date" on Form B automatically when i give another date in the control "Reference Date" on form A, and vice versa?

Thanx in advance

Comments

  • Options
    ShenpenShenpen Member Posts: 386
    Create a function on Form B. UpdateNewDate that sets this field by a date value received in a parametern, and then just code to Form A - OnValidate or OnAfterValidate to varFormB.UpdateNewDate("Reference Date")

    Do It Yourself is they key. Standard code might work - your code surely works.
  • Options
    SeppeSeppe Member Posts: 14
    Thanx for answering Shenpen,

    When I open form A, form B opens, both with the workdate as the default date.
    But the problem is that, when I change my date in form A, he doesn't change on form B, so I put an "Update" in my function.
    Then when I change my date in form A, I get a message that says : "The form is not open"

    If lethere is a solution, please t me know! ](*,)
  • Options
    jonsan21jonsan21 Member Posts: 118
    Hi Seppe,

    If I don't understand wrongly, the flow should be something like:

    1. User open form A
    2. in the form A, create an instance of form B (with and update function in it to update a global var inside form B)
    3. use update function set global var in form B
    4. open form B

    Actually I am just re-iterating shenpe's answer.

    Rgds,

    Jon.
    Rgds,

    Jon.
  • Options
    ArhontisArhontis Member Posts: 667
    Hi,

    Keep in mind that that way the 'vice versa' thing doesn't work. You can update the data on Form B from the Form A (since the Form A has created an instance of Form B), but there is no way to update Form A with values from Form B.
  • Options
    HalMdyHalMdy Member Posts: 429
    Arhontis wrote:
    but there is no way to update Form A with values from Form B.


    One only heavy method : a timer on Form A that periodically reads information from Form B . But not recommended ...
  • Options
    SeppeSeppe Member Posts: 14
    Hi Jon,


    Form A and form B open on the same time. After opening these forms, I want to change a variable on form A, and I want the variable on form B takes over these changes without closing and reopen.

    Regards
  • Options
    HalMdyHalMdy Member Posts: 429
    Seppe wrote:

    Form A and form B open on the same time.

    What do you mean by "on the same time" ? Somethink like :
    FormA.RUN;
    FormB.RUN;

    In this case, there is no link between both forms, so, to pass informations :

    - work with a table where you put the information and read it back in the Forms with a timer.

    OR
    - work with a "single instance" CodeUnit 1, create a variable to store the information in the CU 1 and read it from the Forms with a timer.

    As you see, not so easy ...
  • Options
    SeppeSeppe Member Posts: 14
    Hal,

    Nothing is easy here! :whistle:

    No, it's a simple FormB.RUN in the Onopen trigger of FormA.

    In form A I made a variable of form B, to call the function in form B that takes over the changes in Form A. But on form B, I have to use an UPDATE function in order to see the changes. When I use the UPDATE function it gives me the message that form B is not open.
    The 'vice versa' stuff is no longer necessary.


    Regards
Sign In or Register to comment.