How to get this working??

  • Thread starter Thread starter Michael Mak
  • Start date Start date
M

Michael Mak

Im having trouble with my assignment related to Visual
Basic, my problem is i've created one text box and one
label box. In my text box, it requires the user to type
in a number. Im trying to wrtie a code which can group
the number into different group represented by a letter.

Private Sub cmdCalculate_Click()
Dim txtAwardMiles As Integer
Dim lblAwardZone As Integer
lblAwardZone.Caption = txtAwardMiles.Text
Select Case txtAwardMiles.Text
Case Is = 1 < 600
lblAwardZone.Caption = "S"
Case Is = 601 < 1200
lblAwardZone.Caption = "A"
Case Is = 1201 < 2500
lblAwardZone.Caption = "B"
Case Is = 2501 < 5000
lblAwardZone.Caption = "C"
Case Is = 5001 < 7500
lblAwardZone.Caption = "D"
Case Is = 7501 < 10000
lblAwardZone.Caption = "E"
Case Is > 10001
lblAwardZone.Caption = "F"
End Select
End Sub
0-600 = S
601-1200 = A
1201-2500 = B and so on
However when i run the problem and put number in it, the
windows came up and said:
Compile Error:
Invalid qualifier
Could anyone please help me, thanks a lot! :)
 
Case Is = 1 < 600

should be

Case 1 to 600

Fix this for each case statement.


HTH,
Jeremy
 
if its the val of the textbox you want you need to

Select Case val(txtawardmiles.text)

and the cases should look like this

Case 1 to 600
do something
case 601 to 1200


and so on

Mark
 
Back
Top