Automatically Check a box if certain fields are withing a range of numbers

rscott1989

Registered User.
Local time
Today, 21:09
Joined
Oct 24, 2013
Messages
21
Hello everyone,

I have 3 fields on a form PU_POINTS, SU_POINTS & 2_MILE_RUN_POINTS. The user enters a number 1-100 in each of these fields. If the user enters a number in any of the 3 fields of anything less than 60 then I want it to check a fail box. If the user enters all numbers 60 or more then i want it to check a pass box.

Any ideas on how to make this happen???
 
Call the following subroutine from the point where you want the evaluation carried out. For illustration, I have called the two CheckBoxes 'ckbFail' and 'ckbPass', but you can substitute your own field names.
Code:
Private Sub check60
Rem set failed state by default
ckbPass = False
ckbFail = True
Rem test conditions and exit if any is below threshold
If Nz(PU_POINTS, 0) < 60 Then Exit Sub
If Nz(SU_POINTS, 0) < 60 Then Exit Sub
If Nz(2_MILE_RUN_POINTS, 0) < 60 Then Exit Sub
Rem passed all conditions so set passed state
ckbFail = False
ckbPass = True
End Sub
you could adapt this to go in-line in something like the Form BeforeUpdate event, depending on your logic needs.
 
This code assumes that all values have been entered. Using Form BeforeUpdate, the code won't be triggered if the record is not changed.

I'd have a separate procedure which would be called on Form Load and the Update event of each of the entered fields. Confirm data has been entered in all fields and satisfies the quantity criteria before setting the Pass check box.
 

Users who are viewing this thread

Back
Top Bottom