Results 1 to 7 of 7
  1. #1
    JAPA1972 is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Jan 2019
    Posts
    14

    Filter won't work

    I would like to set a filter in a form (frmMainForm) from an access module. frmMainForm has a textbox control associated with a table field called "NAME_ONE" The below code will fail to find a record, even thought "120-595" is a valid value.



    What am I doing wrong here? Thanks



    Forms!frmMainForm.Filter = "NAME_ONE = '120-5965'"
    Forms!frmMainForm.FilterOn = True

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    There's nothing wrong syntax-wise. I note you have specified two different values. Is the one in code correct? Does the code throw an error or do you just get a blank form? Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    You are in the same form you're filtering?

    me.filter=...
    me.filterOn=true

  4. #4
    JAPA1972 is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Jan 2019
    Posts
    14
    Quote Originally Posted by ranman256 View Post
    You are in the same form you're filtering?

    me.filter=...
    me.filterOn=true

    I am in a different module, a regular module. 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
    Did you notice post 2?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    The records are on the main form (not a subform) and when the filter is not set, there is a record on the main form with that value?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    JAPA1972 is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Jan 2019
    Posts
    14
    Thanks for your help. It seems that Access seems to be corrupt in my computer. I need to figure out how to clean it.

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

Similar Threads

  1. Onload event doesn't work for filter
    By tagteam in forum Forms
    Replies: 2
    Last Post: 02-12-2014, 11:54 AM
  2. filter don't work?
    By ck4794 in forum Programming
    Replies: 3
    Last Post: 10-22-2013, 04:30 PM
  3. In Access Form How Does Filter Work
    By EddieN1 in forum SQL Server
    Replies: 3
    Last Post: 09-05-2013, 03:10 PM
  4. Replies: 2
    Last Post: 11-12-2011, 08:37 AM
  5. Filter on subform doesn't work
    By Edwardo in forum Programming
    Replies: 6
    Last Post: 11-29-2010, 08:57 PM

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