Saturday, February 25, 2012

Pass fields as array to custom function?

I created a custom function that accepts an array of strings as a input. I need to pass several fields from the dataset to this function as an array. How can I do this?

You would need to create a function in the code window that accepts the values and inserts them into an array.

ex.

Code Snippet

Function CreateArray(ByVal field1 As String, ByVal field2 As String) As Array
Dim ar(1) As String
ar(0) = field1
ar(1) = field2
Return ar
End Function

I haven't tested it, but I think it will work.

Simone

|||

You can use the Split function.

http://msdn2.microsoft.com/en-us/library/6x627e5f(VS.80).aspx

|||That is true but you would still need to create a string to split using the required fields. Depending on the data those fields contain, you would need to be careful if they hold the delimeter used in the split function.

No comments:

Post a Comment