Conditional Formatting

  • Thread starter Thread starter KAZ
  • Start date Start date
K

KAZ

Guest
Hi Everyone
I need your help
I have an age field whoose control source is a Date of Birth Field.
The age is automatically input based on the entry in the Date of Birth field.

I need to prevent any record with an age under 16 from being entered and need the age if under 16 to be brought to the user's attention-and for them to cancel or try again

Any Clues

Greatly welcomed

Thanks:(
 
try this as VBA behind in controls before update event

Private Sub Text0_BeforeUpdate(Cancel As Integer)
If Me.Text0 > DateAdd("yyyy", -16, Now()) Then
MsgBox "Age is below 16 please,try again", vbExclamation, "Incorrect Age"
Cancel = True
Me.Text0.Undo
End If
End Sub

Thsi will work if you absolutely do not want to a date entering that is over 16 years ago from today(now).
 

Users who are viewing this thread

Back
Top Bottom