How to make an form active from other form?

kaustubhkkaustubhk Member Posts: 6
hii
I have purchase Invoice form..In the purchase invoice i have a button"Button 1"...In purchase invoice subform..If i delete some lines..I want the button to get disabled automatically..I tried to call a function on On Delete trigger of Purchase Invoice subform..I guess the Purch Invoice form is not get activated is there a way out..awating reply

Comments

  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]

    You cannot call the mainform from the subform.
    If you want to do this, you need to do that using a singleinstance codeunit. The subform sends some info into it and the mainform gets the info from it by using some code in the OnAFterGetCurrentRecord-trigger or the OnTimer trigger.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • kitikkitik Member Posts: 230
    Haven't tried but you could do something like this:
    1. Create a global bool variable on the subform (var1)
    2. When the delete is done set var1 to TRUE
    3. Create a function on the subform (GetVarValue) whith this code: EXIT(var1)

    4. From the mainform call the GetVarValue function to know if you have to disable the button

    Salut!
    Laura Nicolàs
    Author of the book Implementing Dynamics NAV 2013
    Cursos Dynamics NAV (spanish) : http://clipdynamics.com/ - A new lesson released every day.
  • vijay_gvijay_g Member Posts: 884
    I think the correct way to do this use OnTimer trigger of mainform because if you go anyother way there must have refersh problem either you have done it perfactly.

    as far as my personal experience that i have tried.
  • MBergerMBerger Member Posts: 413
    Don't go hacking away with these kinds of things. the best way is the Navision way : don't try to enable or disable the button, but have the code that is called from it check if there are lines or not, and give an appropriate message to the user. Easy, and no messing about with timers etc.
  • KYDutchieKYDutchie Member Posts: 345
    Hi,

    If the requirement is absolutely required, search the forum for "Update Main form from subform using XML"
    Here is one of the topics returned:
    http://www.mibuso.com/forum/viewtopic.php?t=22564&highlight=

    You can use the XML solution that is suggested by Garak, it works perfectly

    Regards,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • kaustubhkkaustubhk Member Posts: 6
    Thnks solved :D
Sign In or Register to comment.