Code:
Public Function calcola_tipo_strumento(r111, r222) As String
select case r111
case "11", "53"
calcola_tipo_strumento = "conto"
case "58", "59", "60"
calcola_tipo_strumento = "carta"
case "99"
select case r222
case "1"
calcola_tipo_strumento = "aaa"
case "0"
calcola_tipo_strumento = "bbb"
case else
end select
end select
end function
Your function is much easier to understand if coded as above with Select Case rather than nested IF-Then-Else.
Your query makes no sense. Explain what it is intended to do.