Results 1 to 3 of 3
  1. #1
    fountaiw is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    2

    How to permanently delete a filter?

    So I have a form that is ordered by the field Control_Number. I want to put an unbound box (called Search_CN) on the form where I can type in a number and a command button to go straight to the record that matches that number. I have it setup as follows:

    Private Sub ClearFilter_Btn_Click()

    Me.Filter = ""
    Me.FilterOn = False
    Me.Requery

    End Sub

    Private Sub Command52_Click()

    Me.Filter = "Control_Number = Me.Search_CN"


    Me.FilterOn = True
    Me.Search_CN = Null

    End Sub

    It works great the first time. I can filter and unfilter with any number I like. However, if I enter a different number and click the filter, it still goes to the first number. Seems like there is no way to replace the first filter. What am I missing? Is there a better way to do this? Ultimately I want to be able to "warp" straight to a specific record, go back to all records, and then go to a different specific record. Thanks

    Will

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Don't put the variable parameter within quotes - use concatenation. If Control_Number is text then need apostrophe delimiters.

    Me.Filter = "Control_Number = '" & Me.Search_CN & "'"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    fountaiw is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    2
    That works great. Thanks!

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

Similar Threads

  1. Replies: 5
    Last Post: 03-14-2013, 09:42 AM
  2. Checkbox to Permanently Close Form
    By Heatshiver in forum Forms
    Replies: 2
    Last Post: 12-29-2011, 10:17 AM
  3. Replies: 2
    Last Post: 04-28-2011, 07:30 PM
  4. Replies: 1
    Last Post: 04-17-2011, 06:57 PM
  5. Replies: 4
    Last Post: 01-02-2011, 08:09 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