B
Brad Pears
I have some code that is updating a DB table using SQL.
There are various field types, currency, boolean and string
I am using a function to set a value and in that function I want to check
for null values. However, the value passed to the function is of type
variant because it could be of various data types.
What syntax is there to check the "type" of variable passed to the function
so that I can code accordingly based on the variable type??
here is an example...
curBasePrice = SetValue(Price) ' Currency type
bolTaxExempt = SetValue(TaxExempt) ' boolean
strName = setValue(Name) ' Cust Name
Private Function SetValue(Value as variant)
if isnull(Value) then
' Check to see what type of data we have
' Pseudo code here - this is what I am unsure of...
if Value.type is Currency then
Value = 0
else if value.type is Boolean then
Value = False
else if value.type is string then
value = ""
endif
End Function
Thanks,
Brad
There are various field types, currency, boolean and string
I am using a function to set a value and in that function I want to check
for null values. However, the value passed to the function is of type
variant because it could be of various data types.
What syntax is there to check the "type" of variable passed to the function
so that I can code accordingly based on the variable type??
here is an example...
curBasePrice = SetValue(Price) ' Currency type
bolTaxExempt = SetValue(TaxExempt) ' boolean
strName = setValue(Name) ' Cust Name
Private Function SetValue(Value as variant)
if isnull(Value) then
' Check to see what type of data we have
' Pseudo code here - this is what I am unsure of...
if Value.type is Currency then
Value = 0
else if value.type is Boolean then
Value = False
else if value.type is string then
value = ""
endif
End Function
Thanks,
Brad