Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List rowsource at runtime

Status
Not open for further replies.

ziwacky

Programmer
Jun 27, 2000
43
US
Hi,

Is there a way I can know or see the rowsource of a list or drop down list at runtime.

I have two drop down lists. One with names and the second ones have records attached to those names. I have set a rowsource for the second list at design time that will change depending on the selection of the first list, then I have a step that may change that rowsource at runtime.

What happens is that after I've changed the rowsource at runtime for the second list, if I change my selection in the first list(names) it seems like if it still using the rowsource I changed at runtime. I can't find a way to bring it back to the rowsource I originally had. I've tried refreshing the list and refreshing the form. I know I can play with the rowsource programatically, but I'm trying to find the short way of it.

Thanks,

Z
 
I think there are couple ways to do this.
One way is to store the row source into a variable. Depending if your rowsource type, but I'm pretty sure you can always use a string or variant variable to store the list box's row source like so: variant = listBox.RowSource.
Then when you're ready to change it back, just set the RowSource back to the variant like so: listBox.RowSource = variant.
The other way you can do is to 'cheat', in a way. Create another list box that has the same rowsource. But make the visible property to No for the second list box so users can't see it, then when you're ready to chage the first list box's row source, set it equal to the second list box's row source like so: listBox1.RowSource = listBox2.RowSource
Hope it helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top