Question : Function returning Type Mismatch error

I have the code you see below, written in VB6. I am populating the int variable FILENOVal with the return value from the PadValue function. It seems that no matter how I attempt to cast the values in the call to the function, I am getting the Type Mismatch error. The code will not even go into the function itself, it dies at the call. Any help?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
Dim FILENOVal As Integer

FILENOVal = PadValue(Val(Len(adoRst("FILENO"))))

Public Function PadValue(ByVal len As Integer) As String
        Dim ReturnValue As String
        Dim lenVal As Integer
        Dim i As Integer

        ReturnValue = ""
        i = 1
        lenVal = 5 - len

        If len <> 5 Then
            For i = 1 To lenVal
                ReturnValue &= "0"
            Next
        End If

        PadValue = ReturnValue
    End Function

Answer : Function returning Type Mismatch error

VAL returns a type of DOUBLE, which will not fit inside of an INTEGER without truncation. Try using CINT inseated of VAL.
Random Solutions  
 
programming4us programming4us