PDA

View Full Version : Dependent select list


Sailors
11-04-2009, 03:19 AM
Hi All,

Please is it possible to set up dependent select list between two fields that get their values from the recordset? E.g the values of "State" will be dependent on the selected value of "Country".

Please what are the steps if possible.

Cheers.

Jason Byrnes
11-04-2009, 01:49 PM
use Dynamic Drop Downs


You should have 2 tables:
Country:
CountryID - Primarykey
CountryName

states:
stateID - primary key
stateCountryID - foreign key to country.countryID
stateName


for the parent list create a recordset:
SELECT * FROM Country

Set the list to be dynamic. In the dynamic properties for the list, set the value to the CountryID column, and the label to the CountryName column.

Create a recordset for the states:
SELECT * FROM states

The add a Create Dynamic Array server behavior to the page, set the parent ID to the stateCountryID, set the Child ID to the stateID, set the child name to the stateName column.


now, in design view, select the parent list, on the behaviors panel click the plus button and select Dynamic Drop downs -> Populate List From Array

Set the parent list to the country list and the child list to the state list.