Results 1 to 5 of 5
  1. #1
    udigold1 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2010
    Posts
    29

    Issues with change event of textbox

    Hi,

    I'm trying to filter a listbox with a query Rowsource through a textbox:
    filter code:
    Code:
    "....WHERE (((tb15_Securities.tb15_NiarID) Like [forms]![formDefineEquity]![txtSearch] & "*"));  "
    So I'm using a change event for the textbox to requery the listbox, but the problem is that the change event fires up before there's a value in it.
    (not like in Excel when the change event works after there's a value)
    The only way that I've managed to do so is to use the 'after_update' event - but it's cumbersome, because I want the filter to work dynamically :


    I.E. - whenever the textbox changes so will the the listbox without having to press the tab key.

    Is there a solution?

    Thank you!

  2. #2
    Minty is online now VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    That's the way the change event is designed to work (effectively per keypress), you could however program it to ignore a Len() < 1 of your text box ?

    If that doesn't work, do a search for filter as you type, there are some good examples about that might assist you.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    The change event fires with every keystroke, so it fires when you type the first character. If you want that, you have to use the .Text property. If not, use the after update event instead.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    udigold1 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2010
    Posts
    29
    Quote Originally Posted by pbaldy View Post
    The change event fires with every keystroke, so it fires when you type the first character. If you want that, you have to use the .Text property. If not, use the after update event instead.
    Thank you! I have used the .Text property and it works like a charm!
    Thanks!

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-24-2018, 09:37 AM
  2. Replies: 7
    Last Post: 05-18-2018, 01:38 AM
  3. Change from DAO to ADO causing issues
    By PinkLady50 in forum Programming
    Replies: 17
    Last Post: 05-15-2017, 03:13 PM
  4. How to call After update event to the textbox
    By pwalter83 in forum Forms
    Replies: 1
    Last Post: 12-20-2011, 11:16 AM
  5. Password change issues
    By westeral in forum Access
    Replies: 0
    Last Post: 11-28-2009, 09:20 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums