Discussion Locked

drop down list creation

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
When a drop down list of ten products has been created using Data Validation, how do you cause the choice of just ONE of the products to open up another drop down list in the next cell on the row?

5 replies

by matthew.alverson

Depends on your development enviroment. But most would be able to apply a filter to the second drop down from within the change event of the first drop down

Private Sub Combo1_Changed()
'Apply filter to data source for combo2
end sub

by bob sellman

You don't say what you're doing this in, so I'll use Access (which also works for VB) as an example. Other languages should have similar capabilities.

There are a few steps to follow.

First, the next column or cell in the row should use a query as it's data source that is based on the first drop down list (call the first list cboFirst and the second cboSecond). So the data source for cboSecond would be something like:

SELECT secondColumn FROM [tablename] WHERE [FirstColumn] = me.cboFirst

If you're doing this in Access (VBA) or VB and the first drop down choice is text, surround me.cboFirst with single quotes (if a date, surround it with #).

The next important step is that you need a property on cboFirst that forces cboSecond to be requeried (or recalculated) when cboFirst is updated. Otherwise, the list for cboSecond will always be based on the first list created when you opened the form and made the first entry in cboFirst.

This discussion is closed to new replies.