Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Filter listbox from textbox (stubborn) (2000)

    I have a list box populated from a query. The filter criteria comes from data entered in a text box. For the Change event of my text box, I use lstNames.Requery. However, my list box will only apply the filter after I completely leave the text box. Any idea why?
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Filter listbox from textbox (stubborn) (2000)

    Are you sure it is a good idea to have the list box change as the user is typing? It would probably make me nervous...

    If you really want that, you must refer to the Text property of the text box in the row source of the list box; that is what changes as the user types. If you just refer to the text box, you are referring to the "stored" value. In other words, the criteria in the query must look like

    [Forms]![FormName]![TextboxName].[Text]

    with the appropriate names substituted.

  3. #3
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filter listbox from textbox (stubborn) (2000)

    Hans, the users know that as they type it will filter the list box, it's actually the sole purpose of that text box...(it just isn't working properly)... Is that why you say it would make you nervous? For the last part of your example "[Text]" , what would I put? Isn't that referring to the changing value?
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Filter listbox from textbox (stubborn) (2000)

    Enter [Text] literally - it's the name of a property of the text box.

  5. #5
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filter listbox from textbox (stubborn) (2000)

    All I had to do to my current criteria was add ".[Text]"... <img src=/S/stupidme.gif border=0 alt=stupidme width=30 height=30>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

Posting Permissions

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