Private Sub Form_Load()
Dim ctls As Controls
Dim ctl As Control
Set ctls = Me.Form.Controls
For Each ctl In ctls
If Asc(ctl.Name) >= Asc("A") And Asc(ctl.Name) <= Asc("F") Then
ctl.OnGotFocus = "=AllOnGotFocus('" & ctl.Name & "')"
End If
Next ctl
End Sub
Function AllOnGotFocus(ctlName As String)
Dim ctls As Controls
Dim ctl As Control
Dim S As Single
Set ctls = Me.Form.Controls
For Each ctl In ctls
If Asc(ctl.Name) >= Asc("A") And Asc(ctl.Name) <= Asc("F") Then
If ctl.Name <> ctlName Then
S = S + Nz(ctl.Value, 0)
End If
End If
Next ctl
S = 10000 - S
ctls(ctlName).ValidationRule = "<" & S
End Function