I had a similar issue. I resolved it by creating a copy of the project files folder, renaming it and then using the "remove code" option from within form options to strip out the old code. Then saved the form without code, re-opened it and attached the newly created copy of the project files folder.
Not sure if that's exactly the same as what you are experiencing, but it definitely worked for me on multiple forms.
Good luck!