Question : Building a Where Clause based on Check Box

I have a web page with 2 text boxes and four check boxes.

The FIrst text box is for Saleman ID
The check boxes are for Bids, Returns, Partial, and Regular
The second text box is to hold the Where clause that I want to pass as a session var to the results page.

So basically someone goes to this page, puts in the saleman ID and checks the types of orders to be returned. Which may be one, two, three, or all four.

Sounds simple enough but I can not get this to work.

Here is what I am trying  now

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

        Session("SalesmanID") = TextBox1.Text.ToUpper
        If cbBids.Checked Then
            TextBox2.Text = "sotype = 'B'"
        ElseIf cbReturns.Checked Then
            TextBox2.Text = TextBox2.Text & " " Or "sotype = 'R'"
        ElseIf cbPartial.Checked Then
            TextBox2.Text = TextBox2.Text & " " Or "sotype = 'O'"
        ElseIf cbRegular.Checked Then
            TextBox2.Text = TextBox2.Text & " " Or "sotype = ''"
        End If
        Session("what") = TextBox2.Text
        MsgBox(TextBox2.Text)

        'Response.Redirect("SOS.aspx")

    End Sub

I also tried
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

        Session("SalesmanID") = TextBox1.Text.ToUpper
        If cbBids.Checked Then
            TextBox2.Text = "sotype = 'B'"
        End If

        If cbReturns.Checked Then
            TextBox2.Text = TextBox2.Text + " " Or "sotype = 'R'"
        End If

        If cbPartial.Checked Then
            TextBox2.Text = TextBox2.Text & " " Or "sotype = 'O'"
        End If

        If cbRegular.Checked Then
            TextBox2.Text = TextBox2.Text & " " Or "sotype = ''"
        End If

        Session("what") = TextBox2.Text
        MsgBox(TextBox2.Text)

        'Response.Redirect("SOS.aspx")

    End Sub
The first one only returns the first "B" and the second gives a conversion error

Thanks

Answer : Building a Where Clause based on Check Box

Here is what works for me:
 Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

        Session("SalesmanID") = TextBox1.Text.ToUpper
        If cbBids.Checked Then
            TextBox2.Text = "sotype = 'B'"
        End If

        If cbReturns.Checked Then
            TextBox2.Text = TextBox2.Text & " Or sotype = 'R'"
        End If

        If cbPartial.Checked Then
            TextBox2.Text = TextBox2.Text & " Or sotype = 'O'"
        End If

        If cbRegular.Checked Then
            TextBox2.Text = TextBox2.Text & " Or sotype = ''"
        End If

        Session("what") = TextBox2.Text
        MsgBox(TextBox2.Text)

        'Response.Redirect("SOS.aspx")

    End Sub
Random Solutions  
 
programming4us programming4us