N
Neal Zimm
Hi All,
Am trying to learn about this type of array. I have successfully passed
other arrays to/from Sub's and functions, but clearly I'm missing something
pretty fundamental.
1. I've extracted what I hope are the pertinent lines of code in my
testing. Why is the paramarray not passing properly ? I've read MSo help a
couple of times and other postings here, but still can't 'see' it.
2. What is the "value added" of using a ParamArray versus putting:
Optional AnyVarName as variant = vbEmpty
in a Sub or Function statement and then valuing it as needed ?
Thanks much,
Neal
Sub Learn()
Dim vDCcArgAy() As Variant 'the ParamArray to be, I use option base 1
Dim uDraw as uDraw
Dim sAC as string
ReDim vDCcArgAy(3)
vDCcArgAy(3) = "test"
' in immediate window parm ay here is OK
uDraw = uDrawTESTmakeF 'the record is being made is OK
sAC = sAC_vuDrawF(uDraw, False, vDCcArgAy)
debug.print sAC
end sub
Public Function sAC_vuDrawF(Rec As uDraw, bAddAcctDelim As Boolean,
ParamArray vDCcArgAy()) As String
'Output: One account string from one uDraw record.
' Ubound of vDCcArgAy here is zero, and not being passed to next function,
???
'NOTE: "..." below = other rec. fields not shown to simplify
sAC_vuDrawF = sAC_ViaVarsF(Rec.ACN, Rec.DlvCd, "..." , vDCcArgAy)
End Function
Am trying to learn about this type of array. I have successfully passed
other arrays to/from Sub's and functions, but clearly I'm missing something
pretty fundamental.
1. I've extracted what I hope are the pertinent lines of code in my
testing. Why is the paramarray not passing properly ? I've read MSo help a
couple of times and other postings here, but still can't 'see' it.
2. What is the "value added" of using a ParamArray versus putting:
Optional AnyVarName as variant = vbEmpty
in a Sub or Function statement and then valuing it as needed ?
Thanks much,
Neal
Sub Learn()
Dim vDCcArgAy() As Variant 'the ParamArray to be, I use option base 1
Dim uDraw as uDraw
Dim sAC as string
ReDim vDCcArgAy(3)
vDCcArgAy(3) = "test"
' in immediate window parm ay here is OK
uDraw = uDrawTESTmakeF 'the record is being made is OK
sAC = sAC_vuDrawF(uDraw, False, vDCcArgAy)
debug.print sAC
end sub
Public Function sAC_vuDrawF(Rec As uDraw, bAddAcctDelim As Boolean,
ParamArray vDCcArgAy()) As String
'Output: One account string from one uDraw record.
' Ubound of vDCcArgAy here is zero, and not being passed to next function,
???
'NOTE: "..." below = other rec. fields not shown to simplify
sAC_vuDrawF = sAC_ViaVarsF(Rec.ACN, Rec.DlvCd, "..." , vDCcArgAy)
End Function