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