Connect an existing form to a database

Microsoft Office InfoPath 2003

Show All Show All

Connect an existing form to a database

When you add a data connection that receives data from a database or other type of data source to your Microsoft Office InfoPath 2003 form, you are creating a secondary data source for your form. This data source lets you populate list boxes with values from the database, and bind controls to the fields and groups associated with the database. In general, you can work with the secondary data source in many of the same ways that you work with your form's primary data source.

Notes

  • The values associated with a secondary data source cannot be saved when a user fills out a form, although they can be submitted to a Web service using a submit data connection. In addition, you cannot edit the properties or structure of the fields and groups associated with a secondary data source, nor can you specify default values or custom, noncode-based data validation for those fields.
  • To submit a form to a database, the structure of the form must match the structure of the database. To do this, you must design a form that is based on the database.
  • Without the use of custom code, InfoPath can connect only to Microsoft SQL Server and Microsoft Access databases.
  1. In design mode, click Data Connections on the Tools menu.
  2. In the Data Connections dialog box, click Add.
  3. In the Data Connection Wizard, click Receive data, and then click Next.
  4. On the next page of the wizard, click Database (Microsoft SQL Server or Microsoft Office Access only), and then click Next.
  5. On the next page of the wizard, click Select Database.
  6. In the Select Data Source dialog box, browse to the SQL Server or Access database you want to base the form on, and then click Open.

    Note  If you are connecting to a SQL Server database, you may need to click New Source next to the File name box in the Select Data Source dialog box, and then follow the steps in the wizard to create a remote data source connection to the SQL server.

  7. If there is more than one table in your database, click a primary table for your form in the Select Table dialog box, and then click OK.
  8. Add any additional tables.

    ShowHow?

  9. In the Data Connection Wizard, click Next.
  10. On the next page of the wizard, type a name for the data connection.
  11. If you want to automatically receive data whenever the form is opened by a user, select the Automatically retrieve data when form is opened check box, and then click Finish. If the form does not automatically receive data, you may want to insert a button that retrieves the data when clicked.

Note  The information in this topic may not apply if you are working with a form designed using Microsoft Office InfoPath 2003 without the service pack installed. Learn more