Here's a little piece of code that looks for the date of birth (DOB) on the form and displays a label saying Happy Birthday if it is, otherwise hides it if not.
Feel free to modify - I just find it neat.
Feel free to modify - I just find it neat.
Code:
Private Sub Form_Current()
Dim dteBD As Date
Dim dteToday As Date
Me.lblHappyBDay.Visible = False
If IsNull(Me.DOB) Then
Cancel = True
Exit Sub
Else
dteBD = Format(Me.DOB, "m/d")
dteToday = Format(Date, "m/d")
If dteBD = dteToday Then
Me.lblHappyBDay.Visible = True
Else
Cancel = True
Exit Sub
End If
End If
End Sub