Nashid Iftekhar
Nashid Iftekhar

Reputation: 65

Data validation doesn't work in a calculated field in Access Form

I am having problem in data validation in one of my continuous subforms. There is a total score (TScore) field which is calculated (total of "Score" field) and a max score (MaxScore) field. I want the TScore value to never exceed my MaxScore value. I have tried validation rule (<=[MaxScore]) on TScore but nothing happens. I have also found out that validation rule doesn't work on calculated fields. I have also tried the Form_BeforeUpdate event like the following:

Private Sub Form_BeforeUpdate(Cancel As Integer)
    
    If TScore > MaxScore Then
        MsgBox "The total score cannot be greater than max score.", vbOKOnly, "Warning!"
    
    End If
    
End Sub

PICTURE

But this don't work as well. Now I need some help on this.

Upvotes: 0

Views: 87

Answers (0)

Related Questions