4.4. Updating a Form's Data Source

No matter how well you plan out your forms and the data you base the forms on, there will be many times when you need to modify the data source for a form. Hopefully, you will only be adding a couple of fields to the form that already exists in the database. If you need to modify objects in the database itself, you need to open the database, in Access for example, and modify them there, and then modify the data source in InfoPath.

When you need to modify the data source for a form in InfoPath, use ToolsData Connections. A dialog box listing the current connections used by the form will displayed, as shown in Figure 4-17.

Figure 4.17. Figure 4-17

After highlighting the connection you want to use and clicking Modify, the Data Connection Wizard will be opened again. At that point, you can make your modifications that you want to make. There are a number of ways you can make modifications to the data source. For example, if you want to add a sort order to a table you can use the Edit SQL . . . command or choose the Modify Table command, both on the Data Connection Wizard.

Which command you use will depend on if you are comfortable with working with SQL statements directly or not. If so, then use the Edit SQL . . . command. If you are just adding a sort order to a table, then the best method would be to use the Modify Table command, which opens a fairly user-friendly dialog box.

4.4.1.

4.4.1.1. Try It Out: Adding a Sort Order to tblCustomers

Working with the form you have been using for this chapter:

  1. Choose ToolsData Connections . . . . The Data Connections dialog box will open.

  2. Highlight main connection, and click Modify . . . . The Data Connection Wizard starts.

  3. Click Modify Table. The Sort Order dialog box opens.

  4. Select City. The dialog box will now look like Figure 4-18.

    Figure 4.18. Figure 4-18
  5. Click Finish. The Sort Order dialog box is closed.

  6. Click Next and then Finish to close the Data Connection Wizard.

Now preview the form, type WA for the Region, and click Run Query. You will now see the records in alphabetical order by City, as shown here in Figure 4-19.

You can compare this with Figure 4-15, and you can see that the sort order has been updated as specified.

Figure 4.19. Figure 4-19

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.221.149