ISMISSING

ISMISSING(argname)

Returns the value True or False depending if the optional argument has been passed to a procedure (Boolean).


argnameThe argument name (String).

REMARKS
* A procedure refers to either a subroutine or a function.
* This function is only used in conjunction with Optional Arguments
* This function only works for variables declared as Variant.
* This cannot be used with simple data types (Boolean, Integer, Double, Date, etc) these are always automatically initialised to zero.
* If "argname" is left blank then, True is returned.
* If this function is used on a ParamArray argument then it will always return False.
* To test if an ParamArray is empty compare the upper and lower bounds.
* You can use the ISARRAY function to return True or False depending if the value is an array.
* You can use the ISDATE function to return True or False depending if the value is a date.
* You can use the ISEMPTY function to return True or False depending if the variable has been initialised.
* You can use the ISERROR function to return True or False depending if the value is an error.
* You can use the ISNULL function to return True or False depending if the value contains no data.
* You can use the ISNUMERIC function to return True or False depending if the value is a number.
* You can use the ISOBJECT function to return True or False depending if the variable represents an object.
* In VB.NET, this function has been removed because default values are now required for all optional arguments.
* In VB.NET this function has been replaced with an IsNothing function which can be used to test if a default value is Nothing.
* For the Microsoft documentation refer to learn.microsoft.com

Private Sub MyProcedure(Optional ByVal vVariant As Variant) 
   If IsMissing(vVariant) Then
   End If
End Sub

Private Sub MyProcedure(Optional ByVal bFlag As Boolean)
'does not work, the default for a Boolean data type is always False
   If IsMissing(bFlag) Then
   End If
End Sub

Private Sub MyProcedure(Optional ByVal dtDate As Date)
'does not work, the default for a Date data type is always "0:0:0"
   If IsMissing(dtDate) Then
   End If
End Sub

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top