Max number

A

atros

i have a form in access 2003 with 5 textbox
who can i fount the max number of this 5 textbox
to another textbox, ever time who i change the values
in the 5 textboxs
 
K

Klatuu

Create a function in your form module and make it the Control Source for the
Max Number text box.

Function MaxOfFive() As Variant
varHighValue as Variant

If Me.text1 > Me.text2 Then
varHightValue = Me.text1
End If

If Me.text3 > varHighValue Then
varHighValue = Me.text3
End If

If Me.text4 > varHighValue Then
varHighValue = Me.text4
End If

If Me.text5 > varHighValue Then
varHighValue = Me.text5
End If

MaxOfFive = varHighValue
End Function

In the control souce of the max number text box

=MaxOfFive()
 
Top