Hi Marc,
Here are sample steps using the Access Northwind sample database - if you
can, please do complete these so you can see how this works:
- Create a new InfoPath solution based on the Orders and Order Details
table (when you add the Order Details table you should automatically see
the relationship based on the OrderID)
- From the queryFields, drag CustomerID to the query section
- From the dataFields, drag "d:Orders" to the data section and then choose
"Repeating Section with Controls"
- From the Tools menu, add a new data connection "Receive") to the Products
table from the Northwind database. For this sample, you will only need to
include the ProductID, ProductName and UnitPrice fields
- Right-click on the Order Details Repeating Section, choose Change To and
select Repeating Table
- Right-click on the ProductID field in the Order Details Repeating Table
and choose "Change To" and select Drop-Down List Box
- Right-click on the ProductID drop-down and choose Properties
- On the Data tab in the List Box Entries section choose "Look up values in
a data connection..."
- From the Data Connection box choose Products
- Click the Select XPath button next to Entries
- Highlight d
![Stick Out Tongue :p :p](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
roducts and click OK
- In the Value box, leave this as: @ProductID
- For Display Name, click the button, select ProductName and click OK (you
should be now back to the Data tab on the Properties sheet)
- 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
- Insure the Data Source is set to Main
- Drill down through the dataFields, select the UnitPrice field under
Order_Details and click OK
- Click the button next to Value
- Click Insert Field or Group
- From the Data Source box select Products
- Drill down through the dataFields and highlight UnitPrice
- Click the Filter Data button
- Click Add
- In the first box select ProductID
- In the second box, leave this as "is equal to"
- In the last box choose "Select a Field or Group"
- From the Data Source box choose Main
- Drill down through the dataFields until you can select the ProductID
field under Order_Details and click OK
- Click OK again
- Now click Modify
- From the first box choose The Expression - this will now show you the
expression result of what we just completed and should look like this:
../@ProductID =
xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/d:Orders/d:Order_Details/@
ProductID
- Modify this so it looks like the following:
../@ProductID = current()/../@ProductID
- Click OK 8 times to get back to the form in Design View
- Preview the form
- Enter BERGS as a CustomerID and click the Run Query button
- Make a different ProductID selection in one of the Orders - you should
see the Unit Price field reflect the price for the new product you selected!
I hope this helps!
Scott L. Heim
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.