Results 1 to 4 of 4
  1. #1
    maxbre is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    38

    Unhappy remove filtering of a form

    Hi all



    I have attached the following vba code to a button in a form in order to filter data to be visualised

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>
    Dim filtro_struttura As String

    filtro_struttura = "SELECT * FROM registro_ssa WHERE registro_ssa.cod_struttura=[Forms]![ms_data_entry]![cod_struttura]"

    Me.RecordSource = filtro_struttura

    Me.Requery

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>

    Now I’m stuck because I want to create another button to remove the filtering and display all data
    Any help for this?

    Thanks

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Why not apply and remove a filter instead of the RecordSource?

  3. #3
    maxbre is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    38
    thanks for your reply

    the reason is why I need to create a button on the form to perform the operation of filtering (for the sake of conciseness I do not expalain much more here)

    anyway, to "go back" I have this possibility

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    Dim filtro_struttura As String

    filtro_struttura = "SELECT * FROM registro_ssa "

    Me.RecordSource = filtro_struttura

    Me.Requery
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    but the aftermath is that I'm selecting again all the recordsource
    And by considering the possibility of having many more filtering buttons is not much a convinient solution: so therefore I need to find a way to deselect just that specific filtering and not all

    thsnks

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm not sure you can avoid creating a dynamic WHERE clause every time you want to change the filtering.

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

Similar Threads

  1. Remove items from Tabular Form
    By JoshS in forum Forms
    Replies: 3
    Last Post: 04-26-2010, 02:18 PM
  2. Question on filtering a form
    By jbarrum in forum Forms
    Replies: 12
    Last Post: 02-15-2010, 11:38 AM
  3. How to remove duplicates
    By TonyBender in forum Access
    Replies: 0
    Last Post: 10-21-2009, 10:27 PM
  4. Replies: 0
    Last Post: 08-17-2008, 12:19 PM
  5. Automatic Filtering when Opening form
    By Karyn-2000 in forum Forms
    Replies: 1
    Last Post: 12-03-2005, 09:29 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