Results 1 to 1 of 1

Thread: A Quick Filter

  1. #1
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8

    Unanswered: A Quick Filter

    one of my clients ask me can a have a button next to the Field and when I click it would only show those records

    that got me thing

    in the code just below the

    Option Explicit

    paste this

    Code:
    Sub Filter_it(FeildName, feildvalue)
    Dim aa
        If (Me.FilterOn = False) Then
            Me.Filter = ""
            Me.FilterOn = False
            Select Case VarType(Me(FeildName))
            
            Case "3" 'Numbers
                Me.Filter = "[" & FeildName & "] = " & feildvalue
            Case "8" 'TEXT
                Me.Filter = "[" & FeildName & "] = '" & feildvalue & "'"
            End Select
            Me.FilterOn = True
        Else
            Me.FilterOn = False
        End If
    End Sub
    all i do add a button next to the Feild I want to filter
    on the Click Event


    u just need to add the Select Case for the VarType

    add this

    Code:
    Call Filter_it("Reference", Me.Reference)
    now its My one click Filter

    just though someone would like it
    Last edited by myle; 12-05-12 at 18:24. Reason: spelling
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

Posting Permissions

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