[AccessD] Passing ParamArrays down the line

jwcolby jwcolby at colbyconsulting.com
Sat Sep 3 12:09:12 CDT 2011


I use param arrays to allow me to pass in things like group ids that a user might belong to.  The 
following fails:

Function mPLSUserInGroup(ParamArray Grps() As Variant) As Boolean
     mPLSUserInGroup = cPLS.cCurrUser.pUserInGrp(Grps)
End Function

However the following works:

Function mPLSUserInGroup(ParamArray Grps() As Variant) As Boolean
Dim lGrps() As Variant
     lGrps = Grps
     mPLSUserInGroup = cPLS.cCurrUser.pUserInGrp(lGrps)
End Function

Thus in order to push a paramarray into another function we just need to dim an array, set it equal 
to the paramarray and then push that array on down.

Pretty strange that a ParamArray cannot be directly passed along.

-- 
John W. Colby
www.ColbyConsulting.com



More information about the AccessD mailing list