Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

i have following function in vbscript

Function getno(nom)
select case nom

case 1:
getno="1st Qtr"
Case 2:
getno="2nd Qtr"
case 3:
getno="3rd Qtr"
Case 4:
getno="4th Qtr"
Case 5:
getno="5th Qtr"
Case 6:
getno="6th Qtr"
return getno
end select
End Function

and calling it as below
numval = getno(val)

I am getting error Type mismatch: 'return'when value passed to the function is 6. Its giving error on return statement. Please help.

thanks
Posted
Comments
Amir Mahfoozi 7-May-13 7:21am    
Move the "return getno" line to the line after "end select".

1 solution

You should remove the return statement.
 
Share this answer
 
Comments
PleaseHelpCP 7-May-13 6:53am    
if i remove return function, how will i get value returned by it?
CPallini 7-May-13 8:32am    
The function return value is set assigning getno (that is the variable having the very name of the function) please check out VBScript documentation.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900