G
Guest
Hello,
I have the situation where I need to read a table field value, which can
be of any data type, and convert that to a string. To do this I pass the
field value to a function expecting a Variant parameter and decide on the
best string conversion function after testing the subtype of the Variant
using VarType(). A problem arises when I try to pass that Variant onwards to
my home-brewed function which converts a Boolean parameter to a string like
"YES" or "NO". The compiler does not like this, saying "ByRef argument type
mismatch". If I add the word "ByVal" in front of the Boolean parameter, it
all works, but I don't see how simply using a copy of the Variant resolves
the type mismatch. Can anyone advise me on what's hapening or a better
approach?
Thanks,
Dave.
I have the situation where I need to read a table field value, which can
be of any data type, and convert that to a string. To do this I pass the
field value to a function expecting a Variant parameter and decide on the
best string conversion function after testing the subtype of the Variant
using VarType(). A problem arises when I try to pass that Variant onwards to
my home-brewed function which converts a Boolean parameter to a string like
"YES" or "NO". The compiler does not like this, saying "ByRef argument type
mismatch". If I add the word "ByVal" in front of the Boolean parameter, it
all works, but I don't see how simply using a copy of the Variant resolves
the type mismatch. Can anyone advise me on what's hapening or a better
approach?
Thanks,
Dave.