Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

How to filter using multiple checkboxes in VB 6?

$
0
0
Hi im just starting to explore VB 6 and my project is a database with multiple filtering function using checkboxes. I was able to filter the data with multiple checkboxes but how will I make my code shorter since I have like 15 checkboxes. My code below will only work for a single combination of the checkboxes. Thank you in advance guys.

If check1.Value = 1 Then
If check2.Value = 1 Then
If check3.Value = 1 Then
If check4.Value = 1 Then
If check5.Value = 1 Then

s = -1
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "Select * from table1 where value1 and value2 and value3 and value4 and value5 like '" & s & "%'", cn, adOpenKeyset, adLockOptimistic, adCmdText
Set DataGrid1.DataSource = rs
Set rs = Nothing

End If
End If
End If
End If
End If

Viewing all articles
Browse latest Browse all 42215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>