Consulting

Results 1 to 2 of 2

Thread: Need Listbox to be stored.

  1. #1

    Need Listbox to be stored.

    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!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Don't unload the form, hise it, Me.Hide.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •