Maintaining List Box Selection

Curry

Registered User.
Local time
Tomorrow, 08:11
Joined
Jul 21, 2003
Messages
73
Hi All,

I have a form with a List Box, Multi Select. After a Selection has been made, which could be one or all of a list of a couple of hundred.

I want to be able to maintain this selection when the form is closed and re-opened straight away. The form needs to close down to change a setting that can only be done in design mode. To the user this happens very quickly when they hit a button with the appropriate code however if they do this after their selection is made then the selection is lost.

I want to add some code that looks at the selection made and then reselects this after the form reopens.

Thanks for any assistance...
 
I found a simple solution:

Dim i As Variant, Coll As New Collection

For Each i In MyListBox.ItemsSelected
Coll.Add i
Next

...Code to Open Form in design mode and change Form properties etc... then reopen....

Then put this code at the end

For Each i In Coll
Forms![frmMainform]![MyListBox].Selected(i) = True
Next
 

Users who are viewing this thread

Back
Top Bottom