1. tr Guest

Hi.<BR>I have a function that prints out the "level" of a member.<BR>The Problem: If a member has over 20, he should be "Normal" but it prints out Beginner instead. Thats beacuse he has over 10. But i want it to be if he has BETWEEN 10 and 20, he should be Beginner, 21-30: Normal and so on. Hope you understand.<BR><BR>If he has under 10, i prints out Newbie. like it should. But if he has over 10, no matter how much, it prints "Beginner", it shouldn&#039t be that way!<BR><BR>I print it out with Resonse.Write and then " & isHello(rs("Posts")) & "<BR><BR>Hope you understand.<BR><BR>&#039This is the function.<BR>Function isHello(dt)<BR> <BR> if rs("Posts") &#062;= 10 Then<BR> isHello = "Beginner"<BR><BR> elseif rs("Posts") &#062;= 20 Then<BR> isHello = "Normal"<BR><BR> elseif rs("Posts") &#062;= 30 Then<BR> isHello = "Advanced"<BR><BR> elseif rs("Posts") &#062;= 50 Then<BR> isHello = "Expert"<BR> else<BR> isHello = "Newbie"<BR> end if<BR> <BR>End Function<BR><BR>&#039End of function<BR><BR>PLEASE HELP!!!

2. Senior Member
Join Date
Dec 1969
Posts
138

You need to change to a case statement. You have if rs("Posts") &#062;=10 then<BR>isHello = "Beginner" then a bunch of elseifs. 21 is greater than 10 so it makes isHello beginner and skips the elseifs<BR><BR><BR>Try <BR>Select Case rs("Posts")<BR> Case = 10<BR> isHello = "Newbie"<BR> Case 10-20<BR> isHello = "Beginner"<BR> Case 21-30<BR> isHello = "Normal"<BR> Case 31-49<BR> isHello = "Advanced"<BR> Case &#062; 49<BR> IsHello = "Expert"<BR>End Select<BR><BR>hope this helps<BR><BR>Dennis<BR><BR>

3. tr Guest

Thank you for the codes.!<BR><BR>but now, i am getting this error:<BR>&#039############# ERROR BEGINS ######################<BR>Microsoft VBScript compilation error &#039 800a03ea&#039 <BR><BR>Syntax error <BR><BR>/directory/test.asp, line 30 <BR><BR>Case = 10<BR>-----^<BR>&#039 ################ END of ERROR ######################<BR><BR>Can any help me!!?? Please help! Thanks!<BR>

4. Senior Member
Join Date
Dec 1969
Posts
138

Sorry I was brain dead<BR><BR>Case 10 not case = 10

5. Junior Member
Join Date
Dec 1969
Posts
22