Link a Form to a Database
InfoPath forms can submit data to Microsoft SQL or Microsoft Access databases. In fact, you can build forms directly from SQL and Access tables or queries. Working with existing data sources is where InfoPath forms really start to shine.
Tip
The following examples use the NWind.mdb Access database provided with the Office System 2003.
How to do it
The following procedure is for InfoPath SP1. The Version 1.0 release displays names in the task pane and produces a form containing separate query and data entry views. To build a form from a database table or query:
Select File → Design a Form. InfoPath displays the Design a Form task pane.
Select New Data Connection. InfoPath starts the Data Source Setup Wizard.
Select the Database option and click Next. The Wizard displays the next step.
Click Select Database. The Wizard displays a list of the Office Data Connection (ODC) files found in the My Data Sources folder (Figure 7-16).
Select a data connection or create a new ODC. The Wizard displays the tables and fields from the data connection (Figure 7-17).
Select the fields to include or modify the SQL used to retrieve the data; then click Next. The Wizard displays the final step (Figure 7-18).
Click Finish to generate the form template from the data connection (Figure 7-19).
Figure 7-16. Choose a data source
Figure 7-17. Change the query as needed ...
Get Excel 2003 Programming: A Developer's Notebook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.