[AccessD] Feeding an paramarray to a paramarray

Drew Wutka DWUTKA at Marlow.com
Wed Mar 12 11:21:09 CDT 2008


Ah, here's the problem.  

Function Something(ParamArray tmpGroup() as variant)

Calling Something("1","2","3","4") isn't sending 'Something' an array.
ParamArray is required to be the last argument.  It is also ByVal.  It's
not 'accepting' an array (though it will), it is accepting multiple
arguments and turning them into an array.

If we do this:
Dim tmp(1)
Tmp(0)=1
Tmp(1)=2
Something(tmp)

What we get is an array WITHIN an Array.  Tmp is ONE argument.  The
Something Function actually creates an array with the first element as
the tmp array.  If we send THAT array to another function, we are
getting an array with the first element the paramarray array, with it's
first element the tmp array.  If we send it through again, we'd get a
four level deep array.

So, it is sending the data through, but the way you are dealing with the
ParamArray argument in the second function is based on the conceptual
error that you are getting a single level array.

Let me see if I can give you a better work around.

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Wednesday, March 12, 2008 10:49 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Feeding an paramarray to a paramarray

Drew,

LOL.

>Ya learn something new everyday.

Would you speak into the microphone please...

The "solution" did the trick, but at the expense of eliminating the
ability
to pass in multiple arguments to SecondParamfunction.  It is the keyword
ParamArray that allows the passing in of multiple arguments.  It is
often
useful to have two functions, BOTH of which have param arrays, and be
able
to call either one directly, but also call one from the other.  It is
the
"call one from the other" that is not possible if both have paramarrays.

ParamArrays are indeed a neat trick and one I use all of the time.  What
would be REALLY cool would be to be able to pass into TWO paramarrays
but
that is syntactically impossible - there is no way to denote where
parameters aimed at one array ends and where the parameters aimed at the
next array begins.  The language could be expanded to allow a semicolon
to
denote the end of one list and the beginning of the next but that
doesn't
currently exist.

John W. Colby
Colby Consulting
www.ColbyConsulting.com 
The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.





More information about the AccessD mailing list