J
jfp
I did a brief test and this seemed harmless but i would like to be sure.
What i want is something like this:
A function with some "normal" arguments and then some optional arguments
that allow for the return of more detailed results -- if desired. As an
example, consider a function to delete all records in some table (name
of table is a required arg) that optionally fills in a status string
("22 records were deleted"). In this case, the 2nd arg would be
something like:
ByRef Optional strStatus As String
Now, if the user calls the function and supplies a 2nd argument, then
the status will be written into the string allocated in the calling
function -- OK. What happens if the user doesn't want the status and
omits this argument? The function is still going to do something like
strStatus = " blah blah "
Where does this go? I want to be sure that it does not overwrite
anything.
I realize that i could use a Variant for this argument and then use
IsMissing() to determine whether or not to write to it -- but the above
seems simpler, as long as it works.
What i want is something like this:
A function with some "normal" arguments and then some optional arguments
that allow for the return of more detailed results -- if desired. As an
example, consider a function to delete all records in some table (name
of table is a required arg) that optionally fills in a status string
("22 records were deleted"). In this case, the 2nd arg would be
something like:
ByRef Optional strStatus As String
Now, if the user calls the function and supplies a 2nd argument, then
the status will be written into the string allocated in the calling
function -- OK. What happens if the user doesn't want the status and
omits this argument? The function is still going to do something like
strStatus = " blah blah "
Where does this go? I want to be sure that it does not overwrite
anything.
I realize that i could use a Variant for this argument and then use
IsMissing() to determine whether or not to write to it -- but the above
seems simpler, as long as it works.