I am new to Visual Basic. I am designing a form in InfoPath 2007. I have it setup so a button has to be clicked to "approve" the form (which does a bunch of stuff, including closing the form). Right now I have a message that says "be sure to click Yes when prompted to Save" but I would like to avoid having my users mess this up. I would like to use code to Save and Close the form (code runs after rules from what I have read, so this should work perfectly). I will make the final rule action set a field to the value of "SAVE-AND-CLOSE". I then want the code to run and if it finds the value "SAVE-AND-CLOSE" in the field, it will save (without prompts, the form has already been submitted to SharePoint and opened again from SharePoint at this point) and close.
Can anyone tell me what the code should look like to do this?