Results 1 to 10 of 10

Thread: Im tryin something and i rly rly need help

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2012
    Posts
    8

    Im tryin something and i rly rly need help

    Name:  Sin título.jpg
Views: 144
Size:  246.2 KB

    I want to know if any1 have an idea to filter my datagrid with this checkboxes

    Code:
    Sub listevents()
    
    With Form3
        If .Text1.Text <> "" Then namefilter = "%" + Trim(.Text1.Text) + "%" Else namefilter = ""
        lifefilter = .Text3.Text
        
        For i = 0 To .List1.ListCount - 1
            .List1.ListIndex = i
            If .List1.Selected(i) = True Then
                If abilitiesfilter = "" Then abilitiesfilter = "%" + .List1.Text + "%" Else abilitiesfilter = abilitiesfilter + "' Or Abilities LIKE '" + "%" + .List1.Text + "%"
            End If
        Next i
    
        For i = 0 To .List2.ListCount - 1
            .List2.ListIndex = i
            If .List2.Selected(i) = False Then
                If teamfilter = "" Then teamfilter = "%" + .List2.Text + "%" Else teamfilter = teamfilter + "' And Team NOT LIKE '" + "%" + .List2.Text + "%"
            End If
        Next i
    
        For i = 0 To .List3.ListCount - 1
            .List3.ListIndex = i
            If .List3.Selected(i) = False Then
                If setfilter = "" Then setfilter = .List3.Text Else setfilter = setfilter + "', '" + .List3.Text
            End If
        Next i
        
    '    .Text11.Text = teamfilter
    '    .Text12.Text = abilitiesfilter
        
            
        oRs.Close
        
        '01 STAN X----
        If setfilter <> "" And teamfilter = "" And abilitiesfilter = "" And namefilter = "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Set Not IN ('" & setfilter & "') ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '02 STAN -X---
        ElseIf setfilter = "" And teamfilter <> "" And abilitiesfilter = "" And namefilter = "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Team NOT LIKE '" & teamfilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '03 STAN --X--
        ElseIf setfilter = "" And teamfilter = "" And abilitiesfilter <> "" And namefilter = "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Abilities LIKE '" & abilitiesfilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '04 STAN ---X-
        ElseIf setfilter = "" And teamfilter = "" And abilitiesfilter = "" And namefilter <> "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Name LIKE '" & namefilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '05 STAN XX---
        ElseIf setfilter <> "" And teamfilter <> "" And abilitiesfilter = "" And namefilter = "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Set Not IN ('" & setfilter & "') AND Team not LIKE '" & teamfilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '06 STAN -XX--
        ElseIf setfilter = "" And teamfilter <> "" And abilitiesfilter <> "" And namefilter = "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Team not LIKE '" & teamfilter & "' AND Abilities LIKE '" & abilitiesfilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '07 STAN --XX-
        ElseIf setfilter = "" And teamfilter = "" And abilitiesfilter <> "" And namefilter <> "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Abilities LIKE '" & abilitiesfilter & "' AND Name LIKE '" & namefilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '08 STAN X--X-
        ElseIf setfilter <> "" And teamfilter = "" And abilitiesfilter = "" And namefilter <> "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Set Not IN ('" & setfilter & "') AND Name LIKE '" & namefilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '09 STAN X-X--
        ElseIf setfilter <> "" And teamfilter = "" And abilitiesfilter <> "" And namefilter = "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Set Not IN ('" & setfilter & "') AND Abilities LIKE '" & abilitiesfilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '10 STAN -X-X-
        ElseIf setfilter = "" And teamfilter <> "" And abilitiesfilter = "" And namefilter <> "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Team not LIKE '" & teamfilter & "' AND Name LIKE '" & namefilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '11 STAN XXX--
        ElseIf setfilter <> "" And teamfilter <> "" And abilitiesfilter <> "" And namefilter = "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Set Not IN ('" & setfilter & "') AND Team not LIKE '" & teamfilter & "' AND Abilities LIKE '" & abilitiesfilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '12 STAN -XXX-
        ElseIf setfilter = "" And teamfilter <> "" And abilitiesfilter <> "" And namefilter <> "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Team not LIKE '" & teamfilter & "' AND Abilities LIKE '" & abilitiesfilter & "' AND Name LIKE '" & namefilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '13 STAN X-XX-
        ElseIf setfilter <> "" And teamfilter = "" And abilitiesfilter <> "" And namefilter <> "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Set Not IN ('" & setfilter & "') AND Abilities LIKE '" & abilitiesfilter & "' AND Name LIKE '" & namefilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '14 STAN XX-X-
        ElseIf setfilter <> "" And teamfilter <> "" And abilitiesfilter = "" And namefilter <> "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Set Not IN ('" & setfilter & "') AND Team not LIKE '" & teamfilter & "' AND Name LIKE '" & namefilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '15 STAN XXXX-
        ElseIf setfilter <> "" And teamfilter <> "" And abilitiesfilter <> "" And namefilter <> "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain where Set Not IN ('" & setfilter & "') AND Team not LIKE '" & teamfilter & "' AND Abilities LIKE '" & abilitiesfilter & "' AND Name LIKE '" & namefilter & "' ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '16 STAN -----
        ElseIf setfilter = "" And teamfilter = "" And abilitiesfilter = "" And namefilter = "" And lifefilter = 0 Then
            oRs.Open "select * from heroclixmain ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '17 STAN ----X
        ElseIf setfilter = "" And teamfilter = "" And abilitiesfilter = "" And namefilter = "" And lifefilter <> 0 Then
            oRs.Open "select * from heroclixmain where Points = " & lifefilter & " ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '18 STAN ---XX
        ElseIf setfilter = "" And teamfilter = "" And abilitiesfilter = "" And namefilter <> "" And lifefilter <> 0 Then
            oRs.Open "select * from heroclixmain where Name LIKE '" & namefilter & "' AND Points = " & lifefilter & " ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '19 STAN X---X
        ElseIf setfilter <> "" And teamfilter = "" And abilitiesfilter = "" And namefilter = "" And lifefilter <> 0 Then
            oRs.Open "select * from heroclixmain where Set Not IN ('" & setfilter & "') AND Points = " & lifefilter & " ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '20 STAN -X--X
        ElseIf setfilter = "" And teamfilter <> "" And abilitiesfilter = "" And namefilter = "" And lifefilter <> 0 Then
            oRs.Open "select * from heroclixmain where Team not LIKE '" & teamfilter & "' AND Points = " & lifefilter & " ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '21 STAN --X-X
        ElseIf setfilter = "" And teamfilter = "" And abilitiesfilter <> "" And namefilter = "" And lifefilter <> 0 Then
            oRs.Open "select * from heroclixmain where Abilities LIKE '" & abilitiesfilter & "' AND Points = " & lifefilter & " ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '23 STAN XX--X
        ElseIf setfilter <> "" And teamfilter <> "" And abilitiesfilter = "" And namefilter = "" And lifefilter <> 0 Then
            oRs.Open "select * from heroclixmain where Set Not IN ('" & setfilter & "') AND Team not LIKE '" & teamfilter & "' AND Points = " & lifefilter & " ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '24 STAN -XX-X
        ElseIf setfilter = "" And teamfilter <> "" And abilitiesfilter <> "" And namefilter = "" And lifefilter <> 0 Then
            oRs.Open "select * from heroclixmain where Team not LIKE '" & teamfilter & "' AND Abilities LIKE '" & abilitiesfilter & "' AND Points = " & lifefilter & " ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '25 STAN --XXX
        ElseIf setfilter = "" And teamfilter = "" And abilitiesfilter <> "" And namefilter <> "" And lifefilter <> 0 Then
            oRs.Open "select * from heroclixmain where Abilities LIKE '" & abilitiesfilter & "' AND Name LIKE '" & namefilter & "' AND Points = " & lifefilter & " ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        '26 STAN XXXXX
        ElseIf setfilter <> "" And teamfilter <> "" And abilitiesfilter <> "" And namefilter <> "" And lifefilter <> 0 Then
            oRs.Open "select * from heroclixmain where Set Not IN ('" & setfilter & "') AND Team not LIKE '" & teamfilter & "' AND Abilities LIKE '" & abilitiesfilter & "' AND Name LIKE '" & namefilter & "' AND Points = " & lifefilter & " ORDER BY Code", adoConn, adOpenStatic, adLockOptimistic
        End If
        
          
        Set .DataGrid1.DataSource = oRs
        
    End With
    End Sub
    ]
    Last edited by Hack; Aug 10th, 2012 at 10:53 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width