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

G

Guest

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
 
G

Guest

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top