CanadianAccessUser
Registered User.
- Local time
- , 21:10
- Joined
- Feb 7, 2014
- Messages
- 114
How do I go about adjusting the below Minimum() module code to find the 5 lowest marks on the test, not just THE lowest?... it needs to grab the lowest, then look past the lowest for others with the same mark, then for the second lowest and the third lowest etc...
Many times an employee will score 0 in 3-4 different places and at this point it's only returning the first one it comes across. If the employee gets 0 in three places, as well as a 25% and 33% I need it to return them all: 0, 0, 0, .25, .33
Here is my code for the lowest mark:
OR
How do I go about adjusting my code to skip the lowest mark and find the second so I can create/use 5 different Minimum codes to find the required data?
Any help would be appreciated.
Many times an employee will score 0 in 3-4 different places and at this point it's only returning the first one it comes across. If the employee gets 0 in three places, as well as a 25% and 33% I need it to return them all: 0, 0, 0, .25, .33
Here is my code for the lowest mark:
Code:
Function Minimum(ParamArray FieldArray() As Variant)
' Declare the two local variables.
Dim I As Integer
Dim currentVal As Variant
' Set the variable currentVal equal to the array of values.
currentVal = FieldArray(0)
' Cycle through each value from the row to find the smallest.
For I = 0 To UBound(FieldArray)
If FieldArray(I) < currentVal Then
currentVal = FieldArray(I)
End If
Next I
' Return the minimum value found.
Minimum = currentVal
End Function
OR
How do I go about adjusting my code to skip the lowest mark and find the second so I can create/use 5 different Minimum codes to find the required data?
Any help would be appreciated.