
Originally Posted by
Missinglinq
Instead of the OnCurrent event you need to use the Control Source of the Unbound Textbox. In the Control Source you'd use something along this line:
= [FieldA] + [FieldB]
using your own calculating expression. Then each Unbound Textbox would hold the calculation appropriate for the given Record.
Linq ;0)>
thanks for the answer, but the calculation is REALLY more complicated than that.
What I want to store is the numeric value, but I need to show is the fraction. One box for the whole number, one box for the numerator, and one box for the denominator
That is calculated by this function (custom data type)
Code:
Function GetFraction(ByVal Num As Double) As NombreEnFraction
If Num = 0# Then
GetFraction.entier = 0
GetFraction.numerateur = 0
GetFraction.denominateur = 0
Else
Dim WholeNumber As Integer
Dim DecimalNumber As Double
Dim Numerator As Double
Dim Denomenator As Double
Dim a, b, t As Double
WholeNumber = Fix(Num)
DecimalNumber = Num - Fix(Num)
Numerator = DecimalNumber * 10 ^ (Len(CStr(DecimalNumber)) - 2)
Denomenator = 10 ^ (Len(CStr(DecimalNumber)) - 2)
If Numerator = 0 Then
GetFraction.entier = WholeNumber
GetFraction.numerateur = 0
GetFraction.denominateur = 0
Else
a = Numerator
b = Denomenator
t = 0
While b <> 0
t = b
b = a Mod b
a = t
Wend
'If WholeNumber = 0 Then
' GetFraction = CStr(Numerator / a) & "/" & CStr(Denomenator / a)
'Else
' GetFraction = CStr(WholeNumber) & " " & CStr(Numerator / a) & "/" & CStr(Denomenator / a)
'End If
GetFraction.entier = WholeNumber
GetFraction.numerateur = Numerator / a
GetFraction.denominateur = Denomenator / a
End If
End If
End Function