Is there a way to create a vba function to check 38 textboxes for valid data without having to create 38 different sub procedures (one for each field)?
I currently use the following sub on 1 field only. The other 37 fields need validating in the same way?
Private Sub Amt_Pens_BeforeUpdate(Cancel As Integer)
If Nz(Me.Amt_Pens, "") = "" Or Me.Amt_Pens < 0 Or Me.Amt_Pens > 100 Then
MsgBox "Activity amount must be between 0 and 100.", vbInformation, "Activity Alert"
Cancel = True
FYI. On each textbox there is an AfterUpdate() function that performs calculations on each control so i need the validation to fire on beforeUpdate/LostFocus to avoid this function from running.