Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / March 2006

Tip: Looking for answers? Try searching our database.

Populating one drop down list when something is selected in anothe

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jeff.riley@bp.com - 09 Aug 2005 18:00 GMT
Hello all,

In the query section of the form I have two drop down list boxes.  I would
like to be able to select something in the top box, and then based on that
selection query the database for items to put into the second drop down list
box.  Is this even possible in Infopath?
smaur - 09 Aug 2005 21:51 GMT
You are referring to cascading drop down boxes, you can find numerou
references on how to do this. A quick run down:
First create your first dropdownbox (ddb)
Bind 1st ddb to data source
Create your second ddb
On your second ddb you need to right click and select ddb properties
Under "List Box Entries" select the third bullet, then input the nam
of your data source in the data connection box.
Next click the "Select Path" button next to the "Entries" Box an
select the specific field. Note in the "Select Field or Group" dialo
box there is also filter, click on this filter button. This is wher
you filter out the data dependent on the contents of the first dialo
box.
Click the "Add Filter" button and then input your filter conditions.
Hope this helps

--
smau
Scott L. Heim [MSFT] - 09 Aug 2005 22:34 GMT
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
SDecou - 03 Mar 2006 03:24 GMT
I followed the steps you list below and am experiencing a problem.  When I go
to submit to my database since my first listbox has the Value to a ID field
the ID is what is actually being saved and not the name.  How do I save the
name and not the ID?

> Hi Jeff,
>
[quoted text clipped - 64 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.