Hello,
I am new to MS Access dev and could use some help with this problem.
I'm creating a database for my son's school team to track runners' times'. Fields in the RunnerDataTable are: Time 1, Time 2, Time 3, Time 4.
All are Number, Field Size=Double, Decimal Place=3, Required=No, Indexed=No
I also use the following module to determine the lowest and highest times in each record for that table.
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
Function Maximum(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 largest.
For I = 0 To UBound(FieldArray)
If FieldArray(I) > currentVal Then
currentVal = FieldArray(I)
End If
Next I
' Return the maximum value found.
Maximum = currentVal
End Function
In a Query, I use the following to extract the Minimum and Maximum times from the table for each record.
Slowest Time: Maximum([Time 1],[Time 2],[Time 3],[Time 4])
Fastest Time: Minimum([Time 1],[Time 2],[Time 3],[Time 4])
This works 100% except when trying to sort by ascending or descending in the queries. (I use separate query for each Slowest and Fastest Time sorting.)
The results are for example:
Sorted by Ascending for Fastest Time
10.32
11.456
12.08
20.178
4.23
8.56
9.897
It appears that the program is looking at the first digit and sorting by that number and not the entire number.
Any help is appreciated. Thank you in advance.
I am new to MS Access dev and could use some help with this problem.
I'm creating a database for my son's school team to track runners' times'. Fields in the RunnerDataTable are: Time 1, Time 2, Time 3, Time 4.
All are Number, Field Size=Double, Decimal Place=3, Required=No, Indexed=No
I also use the following module to determine the lowest and highest times in each record for that table.
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
Function Maximum(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 largest.
For I = 0 To UBound(FieldArray)
If FieldArray(I) > currentVal Then
currentVal = FieldArray(I)
End If
Next I
' Return the maximum value found.
Maximum = currentVal
End Function
In a Query, I use the following to extract the Minimum and Maximum times from the table for each record.
Slowest Time: Maximum([Time 1],[Time 2],[Time 3],[Time 4])
Fastest Time: Minimum([Time 1],[Time 2],[Time 3],[Time 4])
This works 100% except when trying to sort by ascending or descending in the queries. (I use separate query for each Slowest and Fastest Time sorting.)
The results are for example:
Sorted by Ascending for Fastest Time
10.32
11.456
12.08
20.178
4.23
8.56
9.897
It appears that the program is looking at the first digit and sorting by that number and not the entire number.
Any help is appreciated. Thank you in advance.