Results 1 to 4 of 4
  1. #1
    vector39 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    May 2017
    Posts
    76

    Datasheet text filters disrupt search bar

    Hi everyone



    As many of you probably know I have a datasheet (split form) and a search bar that filters the datasheet based on whatever the user types in. It works nicely so far and the vba for the search is as follows:

    Code:
    Option Compare Database
    Option Explicit
    
    
    Private Sub cmdReset_Click()
    Me.txtSearch = ""
        Me.SrchText = ""
        DoCmd.Requery
        Me.txtSearch.SetFocus
    End Sub
    
    
    Private Sub SrchText_AfterUpdate()
    Me.SrchText.Requery
    End Sub
    
    
    Private Sub txtSearch_Change()
    'Create a string (text) variable
    
    
        Dim vSearchString As String
        vSearchString = txtSearch.Text
        SrchText.Value = vSearchString
        If Len(Me.SrchText) <> 0 And InStr(Len(SrchText), SrchText, " ", vbTextCompare) Then
            Exit Sub
            End If
        'Me.SearchResults = Me.SearchResults.ItemData(1)
        
        'Me.SearchResults.SetFocus
        DoCmd.Requery
        Me.txtSearch.SetFocus
        If Not IsNull(Len(Me.txtSearch)) Then
            Me.txtSearch.SelStart = Len(Me.txtSearch)
            End If
    End Sub
    the datasheet comes with built-in text filtering options which is nice however I noticed when I used it to filter records, then cleared the filter options, the search bar no longer worked. Can this be fixed? Should I avoid the text filtering options altogether? Or can this be still used without disrupting the search bar? Thank you!

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    Not sure its clear what your issue is. Can you explain again what you are trying to do and what is not working. Maybe give some sample data. So your search filters after each letter they enter in the field?

  3. #3
    vector39 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    May 2017
    Posts
    76
    Quote Originally Posted by Bulzie View Post
    Not sure its clear what your issue is. Can you explain again what you are trying to do and what is not working. Maybe give some sample data. So your search filters after each letter they enter in the field?
    Okay so I have a search bar on a split form that filters the datasheet based on whatever the user types in:
    Click image for larger version. 

Name:	searchbar.PNG 
Views:	8 
Size:	28.9 KB 
ID:	30870
    However when I use the filter features the datasheet already comes with (the little dropdown beside the field name):
    Click image for larger version. 

Name:	textfilter.PNG 
Views:	8 
Size:	3.8 KB 
ID:	30871
    It does a nice job of filtering, however when I clear the filter option and I go to type something into the search bar again, nothing comes up. This is the main issue. It seems using the datasheet's filtering features disrupts the search bar. Should I avoid using these features or can I still use them without disrupting the code behind the search bar?

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    Sounds like when you clear the filter it is not returning to the full recordset back for your search to work again. Do you want them to do that 2nd filter, if not maybe turn that feature off if possible?

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

Similar Threads

  1. Search Form combo box filters
    By pbDudley in forum Forms
    Replies: 15
    Last Post: 03-15-2017, 01:23 PM
  2. A search box that filters through multiple fields
    By WesHarding in forum Queries
    Replies: 4
    Last Post: 02-10-2017, 03:33 PM
  3. 2 Filters on 1 datasheet
    By raffi in forum Modules
    Replies: 3
    Last Post: 11-30-2014, 04:09 AM
  4. Replies: 0
    Last Post: 10-03-2013, 09:53 PM
  5. Replies: 3
    Last Post: 09-15-2010, 12:35 PM

Tags for this Thread

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