Pass values in a query to a function

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top