|
|
CODE ' Code courtesy of UtterAccess Wiki
' http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary ' Original submission by John White (jwhite) ' Date contributed: 2010/08/27 ' '================================================================================ 'NAME : GetMinArrayValue 'PURPOSE : Returns the Minimum value of variables passed. Alleviates ' the need to compare variable values with lengthy code. 'RETURNS : Variant 'ARGUMENTS: Two or more variables or values, separated by comma's 'REFERENCE: http://msdn.microsoft.com/en-us/library/ct363x9h%28VS.80%29.aspx ' 'USAGE : In VBA Code: ' intMin = GetMinArrayValue(intScore1, intScore2, intScore3) ' ' As Control Source for a Control: ' =GetMinArrayValue([txtScore1], [txtScore2], [txtScore3]) '-------------------------------------------------------------------------------- Function GetMinArrayValue(ParamArray varValues()) As Variant On Error GoTo GetMinArrayValue_Error Dim intCounter As Integer GetMinArrayValue = varValues(0) For intCounter = 1 To UBound(varValues) If varValues(intCounter) < GetMinArrayValue Or IsNull(GetMinArrayValue) Then GetMinArrayValue = varValues(intCounter) End If Next GetMinArrayValue_Cleanup: Exit Function GetMinArrayValue_Error: 'INSERT YOUR ERROR HANDLING CODE HERE Resume GetMinArrayValue_Cleanup End Function
|
| This page was last modified 09:35, 6 April 2011. This page has been accessed 919 times. Disclaimers |