Search/Filter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spideynok
    New Member
    • Feb 2012
    • 14

    Search/Filter

    Goodmorning!

    i have a code
    Code:
    Private Sub btnFilter_Click()
        Dim strFilter As String
      
        With Me
            If .txtFindCardNumber > "" Then
                strFilter = Replace(.txtFindCardNumber, ", ", ",")
                strFilter = "[Card_Number] In('" & Replace(strFilter, ",", "','") & "')"
            End If
      
            .Filter = strFilter
            .FilterOn = (strFilter > "")
        End With
    End Sub
    this is the code on the button connected with a text box which i use when im searching a record.

    the card number is compose of 16 digits. and i must enter 16 digits just to search for that record.

    I want to ask if how would i do. so i can search on it even i input 6 numbers only etc..

    Thank you in advanced. (~_^)olll
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    You can use either a list or wild-cards in filtering, but not a list of wild-card comparisons.

    For more see Find Wildcard Characters in an Access Database.

    Comment

    • spideynok
      New Member
      • Feb 2012
      • 14

      #3
      can i ask sir NeoPa what code i need to put on it?

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        You can ask, but until you explain what you're trying to do more clearly I won't be able to help. I can see you're doing some sort of filtering, but the details make little sense to me.

        Comment

        • spideynok
          New Member
          • Feb 2012
          • 14

          #5
          Yes filtering.. and also like i use it as search. i had a unbounded text box.. and a find record button where i put that code.. and its like when.. example.. im looking for a card number 12345678 for me to show that data.. i need to put exact data like 12345678.. and i want to do is when i put 1234567.. all data that has 1234567 will show.. like 12345671, 12345678, 12345679.. like that..

          Again thank you sir :)

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32633

            #6
            You'd use the wild-card character that matches your database. This is all explained fully and clearly in the linked article.

            Comment

            Working...