Hi Jeff,
Here are some sample steps to show you how to accomplish what you need -
these are using the Microsoft Access Northwind sample database.
- Create a new InfoPath solution using the Orders table from the Northwind
sample database
- Drag the CustomerID and OrderID fields from the "queryFields" to the
query section of the form (we will want the CustomerID field to be the
first choice)
- Change both of these text boxes to drop-down list boxes
- Drag the "Orders" table from the "dataFields" to the data section of the
form
- Right-click on the CustomerID drop-down box and choose Properties
- Under List Box entries, choose "Look up values in a data connection to a
database..."
- Click the Add button to add a new connection
- Select the same database but use the Customers table as the source (you
will only need the CustomerID and CompanyName fields)
- Click the button next to Entries and choose: d:Customers
- Leave "@CustomerID" as the Value but click the button next to Display
Name and choose CompanyName
- - Right-click on the OrderID drop-down box and choose Properties
- Under List Box entries, choose "Look up values in a data connection to a
database..."
- Click the Add button
- Select the same database but use the Orders table as the source (you will
only need the OrderID and CustomerID fields) to add a new connection
- Click the button next to Entries and choose: d:Orders
** Key Steps!! **
- Click the Filter Data button
- Click Add
- In the first drop-down box choose CustomerID
- In the second drop-down box choose Is Equal To
- In the third drop-down box choose Select a Field or Group
- From the Select a Field or Group screen, choose Main from the Data Source
box, expand queryFields and select CustomerID under q:Orders
** End of Key Steps **
- Click OK five times to get back to your form in Design View
- Right-click on the CustomerID drop-down box and choose Properties
- Click the Rules button
- Click Add
- Click Add Action
- From the Action box select "Set a field's value"
- Click the button next to Field, choose your Main data source, expand
queryFields and choose OrderID under q:Orders
- Leave the Value field blank
- Click OK four times to get back to your form in Design View
- Preview the form
- Select a customer from the CustomerID field and then look at the OrderID
box - you should see just a subset of Orders. Now select a different
customer - you should now get a different set of orders!
** NOTE: The reason we added the rule above is to clear out the OrderID box
each time a CustomerID is selected.
I hope all this helps!
Best Regards,
Scott L. Heim
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.