select an item on a 1st list box pop up the second list box

T

Tim

I want to create a list box of items for the user's selection. When the user
selects an item from this list box, a second list box will pop up showing the
corresponding values of this item.

How can I do that? Any examples or code will be greatly appreciated.
Thank you,
tim
 
W

Wayne-I-M

Hi Tim

This is quite a common question – they are called Cascading lists

You need to set the control source of the 2nd list box to refer to the 1st
(hope that makes sense)

Something like this

SELECT TableName.FieldName FROM TableName
WHERE TableName.FieldName = [1stListName]
ORDER By TableName.FieldName;

On the AfterUpdate event of the 1st list box use this

Me![2ndListName].Requery
 
T

Tim

Hi Wayne,
Thank you for your help. I make it works! Here is the next question. How can
I save the data entered by the user's selection into my database? Do I have
to write the code to deal with this situation?

Tim

Wayne-I-M said:
Hi Tim

This is quite a common question – they are called Cascading lists

You need to set the control source of the 2nd list box to refer to the 1st
(hope that makes sense)

Something like this

SELECT TableName.FieldName FROM TableName
WHERE TableName.FieldName = [1stListName]
ORDER By TableName.FieldName;

On the AfterUpdate event of the 1st list box use this

Me![2ndListName].Requery

--
Wayne
Manchester, England.
Not an expert
Enjoy whatever it is you do


Tim said:
I want to create a list box of items for the user's selection. When the user
selects an item from this list box, a second list box will pop up showing the
corresponding values of this item.

How can I do that? Any examples or code will be greatly appreciated.
Thank you,
tim
 
Top