Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2007
    Posts
    214

    Exclamation Unanswered: Search field question

    Hello,

    I have a search field in my database so I can searh my records by social security number. Well after the search is finished, it obviously it displays the record I searched for. Well, it seems to place a "filter" on the databse and in order for me to display all records again i have to close out of the form and reopen it again. So it displays record 1 of 1000 instead of 1 of 1 after I complete the search.

    Is there any kind of command button I can use to remove the "filter" after I use my search field? This isn't a filter that you can remove in the records menu.

    Thanks for any input.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,441
    Provided Answers: 14
    You can do this in VBA:
    Code:
    Me.Filter = ""
    Me.FilterOn = False
    Have a nice day!

  3. #3
    Join Date
    Oct 2007
    Posts
    214
    Do you mean add this in the on click event of a command button? Thanks!

  4. #4
    Join Date
    Mar 2009
    Posts
    5,441
    Provided Answers: 14
    Yes that's it:
    Code:
    Private Sub Button_RemoveFilter_Click()
        Me.Filter = ""
        Me.FilterOn = False
    End Sub
    Be aware that this triggers a Current event in the form.
    Have a nice day!

  5. #5
    Join Date
    Oct 2007
    Posts
    214

    Exclamation

    hello,

    this did not work unfortunately. basically i have a search field with this code.

    If Not IsNull(Me!FSS) Then
    Me.RecordSource = "Select * from [Claim Tracking System] where [Social Security] = '" & Forms![Claims Tracking System]!FSS & "'"
    End If


    when it searches it obviously brings up what i searched for and if it does not find anything it leaves a black record and displays 1 of 1. Well, I may need to use the find and replace feature to search the database manually for different criteria. Well, I am unable to do that because after I use my search field above, the database automatically seems to "filter" the recods and does not display them all.

    How can I reset the "form" or search option to display all of my recods without closing out of the database?

    I prefer to do this via command button, but am not sure of the proper code.

    Thanks!

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Me.RecordSource = "Select * from [Claim Tracking System]"
    Paul

  7. #7
    Join Date
    Oct 2007
    Posts
    214
    Awesome it worked. I knew it was going to be as simple as that just couldn't pin it. Thanks!

  8. #8
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    No problemo!
    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •