[AccessD] Function Return array?

Charlotte Foust cfoust at infostatsystems.com
Fri Feb 6 10:03:55 CST 2004


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

-----Original Message-----
From: S D [mailto:accessd667 at yahoo.com] 
Sent: Friday, February 06, 2004 1:20 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Function Return array?


Andy,
 
I don't get it.
I can indeed create an array, then call the function using the array as
a paramater and then what? I need the values from the array. 
 
Correct if I'm wrong but I still need to return the values from the
function to my event (form OnLoad) How do I do that?
 
I want to achieve the following:
1 - Fill an array with items in the specified listbox.
2 - loop through the array and when the current value of the array
matches with the current item in the listbox...select the item in the
listbox.
 
Hope this makes sence
 
Regards,
 
Sander


Andy Lacey <andy at minstersystems.co.uk> wrote:
Create the array outside the function, pass it in as a parmeter and have
the function fill it?

Andy Lacey
http://www.minstersystems.co.uk 

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of S D
> Sent: 06 February 2004 08:04
> To: accessd
> Subject: [AccessD] Function Return array?
> 
> 
> Hi group,
> 
> I have a function that builds an array. Is it possible to
> let the function return the array?
> 
> Any ideas?
> 
> TIA
> Sander
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/a> ccessd
> Website: 
> http://www.databaseadvisors.com
> 
> 

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

---------------------------------
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list