Procedure Parameter Limit?

D

DCPan

Hi,

I apologize if this has been mentioned before, but I'm not finding the right
words to google this.

So, you know how in functions you can set input parameters?

What's the maximum number of parameter that you can set?

So,

Public Sub Test( Var 1 as text, Var2 as text...)

how many max?

Thanks!
 
T

Tom van Stiphout

On Fri, 16 Jan 2009 16:48:00 -0800, DCPan

I don't know but high enough it should not be a problem.
Note that you can also use a ParamArray if that makes sense. See the
help file on the topic of "Function".
You can also combine arguments in a variant array if that makes sense,
and use the Array keyword to set the values, and a "for each" loop to
pull them out.

-Tom.
Microsoft Access MVP
 
J

John W. Vinson

Hi,

I apologize if this has been mentioned before, but I'm not finding the right
words to google this.

So, you know how in functions you can set input parameters?

What's the maximum number of parameter that you can set?

So,

Public Sub Test( Var 1 as text, Var2 as text...)

how many max?

Thanks!

I couldn't find an explicit limit but... how many do you want and why? You can
pass an Array of values which would be essentially unlimited; or do you
actually have over (say) 255 discrete independent arguments?
 
M

Michel Walsh

You can use a 'structure' (user defined type) or an object name to pass
multiple values with one 'name'.

Private Type Coord3D
x AS Long
y AS Long
z AS Long
End Type

....
Dim alpha AS Coord3D
...
Call MySub( alpha )


The Call send 3 values, alpha.x, alpha.y and alpha.z, using only ONE
argument name, alpha.


If you have a really large number of values to send, using an object can be
faster, since ONLY one reference, rather than an eventual COPY of all
values, will be pushed on the stack.

Note that ByVal and ByRef, to some, may appear as having a slightly
different logical meaning between defined type and object.



Vanderghast, Access MVP
 

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