PDA

View Full Version : Need Listbox to be stored.



avadhutd2
03-03-2010, 06:49 AM
I had a userform in my code where I had couple of listboxes. I launch the form using a button.

For example -
1st one is for DB Table
2nd gives columns from the selected DB Table.

There is freedom for a user to scroll the selected listbox value up or down & rearrange the existing order.

Here I am fetching these values from DB using a SQL. But there is a event when I click on OK button, I had a statement of form unload.
Next time when I click the button again, I get the columns listboxe with column names ordered in the default manner (the manner in which they will be populated from the DB) & not the way there were changed.

I also tried a event userform.hide but that is resulting error when I load the 1st listbox.

To clarify further:
Consider Listbox1 has 5 values as -
A
B
C
D
E

I had re-arranged them from userform as -
C
B
A
E
D

Now when I revisit this form I can see the listbox values again as -
A
B
C
D
E

What I expect is - rearranged output :
C
B
A
E
D


Is there any way how we can store the re-arranged listbox values and later user these values again when we have values entered from DB in default manner.

Can anyone guide me in this matter?

Thanks!

Bob Phillips
03-03-2010, 08:24 AM
Don't unload the form, hise it, Me.Hide.