Results 1 to 2 of 2
  1. #1
    smht is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2017
    Posts
    3

    filtering with VBA code

    hi
    I have a Query and a form that I would like to design a button to apply the filter based on a text box to the query and show the filtered query
    would you please help me how to do that?
    what's the code for that?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    use the AFTERUPDATE event to filter...
    Code:
    sub txtFind_Afterupdate()
    
    if isNull(txtFind) then
       me.filterOn = false
    
    else
       me.filter = "[field]='" & txtFind & "'"
       me.filterOn = true
    end if

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

Similar Threads

  1. Filtering a Form using VBA code
    By Bkper087 in forum Access
    Replies: 9
    Last Post: 05-30-2017, 11:48 PM
  2. filtering of combo box / vba code
    By Kotoca in forum Programming
    Replies: 2
    Last Post: 02-08-2012, 08:15 AM
  3. Need help with filtering form code
    By bgeorge12 in forum Programming
    Replies: 3
    Last Post: 07-16-2011, 06:03 PM
  4. help with filtering code
    By ninachopper in forum Access
    Replies: 14
    Last Post: 09-09-2010, 06:16 PM
  5. filtering code
    By ninachopper in forum Access
    Replies: 2
    Last Post: 08-06-2010, 10:56 AM

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