[AccessD] Max of 20 values

jwcolby jwcolby at colbyconsulting.com
Sat Jul 23 08:46:49 CDT 2011


Bubble sort?

Arthur!!!

I think a set of classes... ;)

Actually a simple function where you pass the control with the data just entered and the MaxReading 
control.  The function compares the value just entered with max reading and sets maxreading to the 
new value if the new value is bigger.

function SetMaxReading(ctlJustEntered as control, ctlMaxReading as control)

	if ctlJustEntered.Value > ctlMaxReading.value then
		ctlMaxReading.value = ctlJustEntered.Value
	endif
end function

If you need to set dirty false then pass in the form as well.

John W. Colby
www.ColbyConsulting.com

On 7/23/2011 8:54 AM, Arthur Fuller wrote:
> I have a form into which the user enters up to 20 values (measurements in
> time). They all default to zero. I'm trying to think of an elegant way to
> find the max value among the 20. Create an array and bubble sort it? I want
> to call this code on the AfterUpdate of each of these 20 controls so the
> control called MaxReading gets a new value if any of the 20 controls goes
> higher than the current MaxReading value.
>
> TIA,
> Arthur



More information about the AccessD mailing list