Conditionally close form onload with code - InfoPath Dev
in

InfoPath Dev

Conditionally close form onload with code

Last post 10-15-2010 01:55 PM by Ted Fitch. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-15-2010 04:45 AM

    • ErikvanD
    • Not Ranked
      Male
    • Joined on 07-02-2007
    • Netherlands
    • Posts 5

    Conditionally close form onload with code

    Hi all,

    I have been developing a form that enables managers to register prognoses for their budgets in the BI datawarehouse. The entire communication with the database is through stored procedures that are called through code (VB in this case). I use Infopath 2010 but save as 2007 as that is my production environment. Database is SQL2008.

    On entering a new prognose I wish to check whether there might already be another prognoses present that is entered at a different level. If this is the case I want to tell the end user that a new prognoses on the desired level is not possible in order to maintain consistency. And after that message I want to close Infopath and return to the report that called the form in the first place. I have made an SP that checks this and gives me the desired error message. I also gives me a bit value (0 = prognoses not allowed, 1 = prognoses not allowed).

    Now my question. I have tried with several different methods to accomplish this but so far no luck.

    First I tried to raise a message box with "application.quit()" assigned to the OK button. But this apparently does not work during the onload event.

    Secondly I tried putting the message in another form (also with an OK button to close IP). This form should load when the bit value = 0. But Infopath cannot load another form while busy loading the first.

    Either way I do get the right message to the end user but after hitting the OK buttun the prognoses input form still opens. Of course I can prevent a new prognoses to be saved as long as the bit value is 0 but I do not want to give the end user the impression he could put in a prognoses while he in fact cannot.

    I hope my problem is clear. If not, please post.

    Kind regards,

    Erik

  • 10-15-2010 01:55 PM In reply to

    Re: Conditionally close form onload with code

    Hi Erik,

    There are some tips in this post that might help: http://www.infopathdev.com/forums/p/9379/33219.aspx

    Hope that helps

    Ted

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.