Userform listbox search problem

  • Hi there,

    I am quit new white VBA but create a userform database, I like to serach records in my database. therefor I created a searsch txt box, in combination with a listbox.

    When I open my userform the data in my listbox are clearly there, but when I try to search to data, the value in de listbox are mixedup. I try alost a week to find the problem but I can't find it.

    does some one know how to solve this, and will help me?

    please see attachment


    • Database1.xlsm

      (55.71 kB, downloaded 99 times, last: )
  • I'm not entirely clear what you want, but you seem to be using the TextBox change event which will trigger each change you make. It would be better to use the exit event.

    Have a look at this userform and see if you can adapt the search in it. Post back if you need further help

  • Thank you for your fast replay, I'm very happy with your help!

    I have look to your file and try the with this codes to solve my problem but unfortunately I have still some trouble to solve it and understand whats happening. I look-over the internet and this form but unfortunately I didn't find a answer.

    I will try to explain what I try to reach,

    I like to make a order request document and work with a other colleague togther.

    1) I create to userforms in the "Order request doc"one for a new request the data will fill in and after save the data will be save on a new row, and create a new order number in the "database doc"

    2) In the second userform "Order request doc" my colleague can ask the same order again and save it on a new row, by the same order number "database doc"

    2.1) in the second my colleague ask the same order number but adapt the request and save it on new row where the same order number with a new version number created "database doc"

    I create a listbox in my userform "Order request doc" and I see the value of the database orders in my userform, when I select a row in my listbox the data will automatically fill in the textboxes, this is working perfrct.

    Because there will be more than 4000 rows filled, I prefer a search option in my listbox, I prefer to fill in the textbox and the search automatically to the database in column A to the right number and fill in the data after select the row in my listbox.

    Now my problem, when search in "Order request doc" in userform same order for example to order number 7 of order number 20.7.2 the listbox is losing his columns structure.


    • Database.xlsm

      (35.27 kB, downloaded 98 times, last: )
    • Oder request.xlsm

      (41.27 kB, downloaded 98 times, last: )