# How do add a greater than option to one of the checkboxes my multiple choice checkbox array?

• ### Question

• User-1995349159 posted

Dear Forum,

I have some check boxes set up so that if 3 bedrooms and 4 bedrooms are both selected, it will search the table for all records with 3 and 4 bedrooms.  I want to set it up so that the fifth checkbox is a greater than checkbox. So that if it is selected it will also search for plans with 5 or more.

How would you recommend I do that?

Right now my instatement variable returns a value like this:  (3,5) if checkbox 3 and 5 is selected.
I would like it to return something that says 3 and any record that is 5 and above.

Jeff

Here is what my code looks like:

Dim chkboxes (5) As Integer

If bedroom1.checked = true chkboxes (0)=1 end if

If bedroom2.checked=true chkboxes (1)=2 end if

If bedroom3.checked = true chkboxes (2)=3 end if

If bedroom4.checked=true chkboxes (3)=4 end if

If bedroom5.checked=true chkboxes (4)=5 end if

Dim inStatement As String inStatement = "("

For i as integer =0 to chkboxes.length -1

If chkboxes(i)<>0 Then

inStatement = inStatement & chkboxes (i) & "," end if Next

If chkboxes.length = 1 Then inStatement= inStatement.Substring(0) end if

inStatement = inStatement.Substring (0, instatement.Length -1)

inStatement = inStatement & ")"

dim SqlCmd as new StringBuilder()
SqlCmd.Append("SELECT * FROM plans WHERE Planname LIKE  '" & Plannametext & "' AND  Sqrft >= '" & Sqrftminint & "' AND  Sqrft <= '" & Sqrftmaxint & "' AND Wide <= '" & Wideint & "' AND Deep <= '" & Deepint & "' AND Bedrooms in " & instatement & " AND  Floors = '" & Floorsint & "' AND  Garages >= '" & Garagesminint & "' AND  Garages <= '" & Garagesmaxint & "'  AND  Alleyfront = '" & Alleyfrontint & "' AND  Baths >= '" & Bathstext & "' ")

Saturday, November 1, 2014 6:17 PM