If I place the script after removeInstance I always get an undefined error, and yet if I move that same script above the removeInstance, then there are no errors
But that's not what I'm trying to achieve.
Any help would be appreciated.
That seems to be the way it works, as soon as you delete the form object that contains the code you are executing it will stop.
Try moving your code to a function in a script object and calling that from your button.
Thanks for your reply Bruce, but I tried what you suggested and it didn't quite work for me. The whole purpose was to invoke the script immediately after removeInstace has been triggered.
I finally moved the script to form:ready event of the button and it works beautifully, just hoping that it won't break anything else further on.
THanks a million