Pass values in a query to a function

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

I have a function called "testit" that I'm calling from a
query. The number of fields that I pass to the testit
function could vary. How do I get the function to accept
any number of arguments? when I attempt to call the
function I get a "wrong number of arguments" error. I was
hoping to pass the argument over as an array.

Thanks in advance


Expression in query:
Expr1: TestIt([Field1],[Field2],[Field3])

Function testit(test())
Dim i As Integer

For i = UBound(test) To LBound(test) Step -1
If Len(Trim(test(i))) > 0 Then
testit = Trim(test(i))
Exit Function
End If
Next i
End Function
 
Back
Top