In Access VBA, I am trying to print the values of a parsed Parameter array but keep getting a Runtime Error 13 - Type Mismatch. The values in the array are mixed types i.e. Double, String, Long.
Code as follows:
Function MyArray() as Variant
Dim MyParams(2) as Variant
MyParams(0) = "3459"
MyParams(1) = "3345"
MyParams(2) = "34.666"
MyArray = MyParams
End Function
Sub PrintArray(ParamArray Params() As Variant)
Dim p_param as Variant
For Each p_param in Params
Debug.Print params < - Error occurs here
Next p_param
End Sub
I tried converting to string etc but it still wont work.
Any suggestions?
p_paramis emptysub? should beFunction PrintArray(ParamArray Params() As Variant)Params()will have 1 parameter and your loop will be iterating once, andp_paramwill be the array you meant to be iterating. ..and that would be a type mismatch error.