You receive a "Visual Studio must be used to add business logic to this form template" error message when you close the Form Options dialog box in InfoPath 2003 (891160)



The information in this article applies to:

  • Microsoft Office InfoPath 2003, Service Pack 1 (SP1)

SYMPTOMS

When you close the Form Options dialog box in Microsoft Office InfoPath 2003, you receive the following error message:
Visual Studio must be used to add business logic to this form template. Please close this form template and open the Visual Studio project for it.
Note If you make changes before you close the Form Options dialog box, the changes are successfully saved even though you receive this error message.

CAUSE

This problem occurs when you create an InfoPath Form Template project in Microsoft Visual Studio .NET 2003 and you click to select the Save using custom code check box in the Forms Options dialog box. When you select this check box, Visual Studio .NET 2003 adds the OnSaveRequest event handler code to the project. Therefore, when you open the form template file (.xsn) outside Visual Studio .NET in InfoPath, you receive the error message.

WORKAROUND

To work around this problem, make design changes to the form template file (.xsn) only when you work in the InfoPath Form Template project in Visual Studio .NET 2003.

MORE INFORMATION

For more information about InfoPath 2003 development in Visual Studio .NET, visit the following Microsoft Developer Network (MSDN) Web site:

Steps to reproduce the behavior

To reproduce the behavior, follow these steps:
  1. Start Visual Studio .NET 2003.
  2. On the File menu, click New, click Project, and then expand Microsoft Office InfoPath Projects.
  3. Click Visual Basic Projects, click InfoPath Form Template, type <InfoPathProjectName> in the Name box, and then click OK.

    Note<InfoPathProjectName> is the name for your InfoPath Form Template project.
  4. In the Microsoft Office Project Wizard, click Create a new form template, and then click Finish.
  5. On the Tools menu, click Form Options, and then click the Open and Save tab.
  6. Click to select the Save using custom code check box, and then click OK.
  7. On the File menu, click Publish, and then click Next two times.
  8. In the Form path and file name box, type <PathandFileName>, and then click Next.

    Note<PathandFileName> is the file name of the form template file (.xsn) and the path where you want to publish the file. For example, type c:\MyForm.xsn.
  9. Click Finish, and then click Close.
  10. On the File menu, click Exit to exit InfoPath 2003.
  11. On the File menu, click Exit to exit Visual Studio .NET.
  12. Start InfoPath 2003.
  13. On the File menu, click Open, select the path and file name that you entered in step 8, and then click Open.
  14. On the Tools menu, click Design This Form.
  15. On the Tools menu, click Form Options, and then click OK.
Note After you click OK in the Form Options dialog box, you receive the error message that is mentioned in the "Symptoms" section.

Modification Type:MajorLast Reviewed:8/22/2006
Keywords:kbProgramming kbdesign kbXML kberrmsg kbinfo kbtshoot kbBug kbprb KB891160 kbAudDeveloper