Ken Ismert
KIsmert at TexasSystems.com
Fri Feb 6 13:29:12 CST 2004
Alternately,
Private Function fnsArray() As String()
Dim sArray() As String
' Contstruct your array....
' Return
fnsArray = sArray
End Function
To use:
Dim sArray() As String
sArray = fnsArray
-Ken
-----Original Message-----
From: Charlotte Foust [mailto:cfoust at infostatsystems.com]
Sent: Friday, February 06, 2004 10:04 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Function Return array?
1. Declare the variable that will hold the returned array as a variant.
Dim varArray as Variant
2. Declare the return value of the function that builds the array as a
variant. Build the array in the function and set the function's return
value to the array, whatever datatype the array may be.
Public Function ReturnArray(lst As Listbox) As Variant
3. Even though the variable in the calling routine is declared as a
variant rather than as an array, it will contain an array that is
returned by the function and you can use it in code as if you had built
the array within that routine.
varArray = ReturnArray(Me.lstSelect)
If Ubound(varArray) > 0 Then
...
Charlotte Foust