Consulting

Results 1 to 2 of 2

Thread: Solved: Case Statement Criteria with 2 levels of assesment

  1. #1
    VBAX Regular
    Joined
    Jul 2008
    Posts
    18
    Location

    Solved: Case Statement Criteria with 2 levels of assesment

    Im creating a simple check if someone earns a good income with different criterias but run through a stump in coding for adding two levels to check.

    Basically theres two textboxes, Checkbox1 to enter either "Yes" or "No" if the person married. Checkbox2 to enter the total Income. CheckBox3 outputs a simple answer.

    Criteria are:
    Single <=1500 = "OK"
    Single =>1500 and <=2000 = "Good"
    Single >2000 = "Excellent

    Married <=?2200 = "OK"
    Married >2200 and <=3000 = "Good"
    Married >3000 = "Excellent"


    I tried to do a case statement as follows but doesnt check if the persons married or not, also not sure how to check values inclusive, can anyone help??

    [vba]
    Select Case TextBox2.Value
    Case "<=1500"
    TextBox3.Text = "OK"

    Case"=>1500 and <=2000"
    TextBox3.Text = "Good"

    Case ">2000"
    TextBox3.Text = "Excellent"
    [/vba]

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Select Case True
    Case TextBox2.Value <= 1500
    TextBox3.Text = "OK"

    Case TextBox2.Value >= 1500 And TextBox2.Value <= 2000
    TextBox3.Text = "Good"

    Case TextBox2.Value > 2000
    TextBox3.Text = "Excellent"
    End Select
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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