Answered by:
Problem in display feet and inches
Question

I have a database that I use to record and display Boy’s Long Jump. I use this function to find the longest jump for each student.
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
There a total of six jumps that each student makes.
I have fields where I get the total inches for each jump: totalinx: ([dis_ft_x]*12)+[dis_in_x]. x is the jump number
I then use this find the longest: Maximum([totalin1],[totalin2],[totalin3],[totalin4],[totalin5],[totalin6])
I then display the jump in feet: longft: Int([longest]/12)
I display the inches using: longin: [longest] Mod 12
The problem is if the inches are like 8.75 it only shows 8.
So how can I get and display the longest jump of 42ft 6.75in
I may be doing this the hard way so any suggestions would be greatly appreciated.
Friday, October 30, 2015 2:40 PM
Answers

Hi,
You could try it this way:
longin: ([longest]/12Int([longest]/12))*12
Hope that helps...
 Proposed as answer by KCDW Friday, October 30, 2015 3:23 PM
 Marked as answer by gehrenfeld1 Saturday, October 31, 2015 1:11 PM
Friday, October 30, 2015 2:53 PM 
part of your issue is that you have defined the answer as integer, rather than double, thus your answer is truncated by definition.
al edlund
Al Edlund Visio MVP
 Marked as answer by gehrenfeld1 Saturday, October 31, 2015 1:11 PM
Friday, October 30, 2015 3:59 PM
All replies

Hi,
You could try it this way:
longin: ([longest]/12Int([longest]/12))*12
Hope that helps...
 Proposed as answer by KCDW Friday, October 30, 2015 3:23 PM
 Marked as answer by gehrenfeld1 Saturday, October 31, 2015 1:11 PM
Friday, October 30, 2015 2:53 PM 
That worked!!!!!
Thank you, Thank you
Friday, October 30, 2015 3:05 PM 
part of your issue is that you have defined the answer as integer, rather than double, thus your answer is truncated by definition.
al edlund
Al Edlund Visio MVP
 Marked as answer by gehrenfeld1 Saturday, October 31, 2015 1:11 PM
Friday, October 30, 2015 3:59 PM 
That worked!!!!!
Thank you, Thank you
Hi,
You're welcome! We're all happy to assist. Good luck with your project.
Friday, October 30, 2015 4:18 PM