Birthday Script

  • Thread starter Thread starter Robbin
  • Start date Start date
R

Robbin

I have this neat little birthday script that I have taken (by permssion) from
another database, and I'm trying to make it work.

I've put the code in the "On Open" event on my form, but it keeps asking me
to do something with the "Birthday Today" part of the code. Seems like this
is a reference that is missing.

Can anyone suggest a fix?

Private Sub Form_Current()

If Not IsNull([DateofBirth]) Then

If BirthdayToday([DateofBirth], Date) Then


Me.lblBirthdayToday.Visible = True
Me.OLEBirthdayCake.Visible = True

Else
Me.lblBirthdayToday.Visible = False
Me.OLEBirthdayCake.Visible = False

End If

Else
Me.lblBirthdayToday.Visible = False
Me.OLEBirthdayCake.Visible = False

End If


End Sub


Thanks in advance.
 
It would appear that BirthdayToday is a function that returns True or False.
Since that's not a built-in function in Access, what's the code in your
application for that function?
 
As Douglas said, you may not have the function BirthDayToday. You don't
really need it. You could use:

Change:
If BirthdayToday([DateofBirth], Date) Then
To:
If Format([DateofBirth],"mmdd") = Format(Date,"mmdd") Then
 
I think that's what's missing! Where does it go? I have a field
[DateOfBirth]. What should it look like and where would it go?

Thank you!
--
Robbin


Douglas J. Steele said:
It would appear that BirthdayToday is a function that returns True or False.
Since that's not a built-in function in Access, what's the code in your
application for that function?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Robbin said:
I have this neat little birthday script that I have taken (by permssion)
from
another database, and I'm trying to make it work.

I've put the code in the "On Open" event on my form, but it keeps asking
me
to do something with the "Birthday Today" part of the code. Seems like
this
is a reference that is missing.

Can anyone suggest a fix?

Private Sub Form_Current()

If Not IsNull([DateofBirth]) Then

If BirthdayToday([DateofBirth], Date) Then


Me.lblBirthdayToday.Visible = True
Me.OLEBirthdayCake.Visible = True

Else
Me.lblBirthdayToday.Visible = False
Me.OLEBirthdayCake.Visible = False

End If

Else
Me.lblBirthdayToday.Visible = False
Me.OLEBirthdayCake.Visible = False

End If


End Sub


Thanks in advance.
 
Thank you both. It worked perfectly!
--
Robbin


Klatuu said:
As Douglas said, you may not have the function BirthDayToday. You don't
really need it. You could use:

Change:
If BirthdayToday([DateofBirth], Date) Then
To:
If Format([DateofBirth],"mmdd") = Format(Date,"mmdd") Then
--
Dave Hargis, Microsoft Access MVP


Robbin said:
I have this neat little birthday script that I have taken (by permssion) from
another database, and I'm trying to make it work.

I've put the code in the "On Open" event on my form, but it keeps asking me
to do something with the "Birthday Today" part of the code. Seems like this
is a reference that is missing.

Can anyone suggest a fix?

Private Sub Form_Current()

If Not IsNull([DateofBirth]) Then

If BirthdayToday([DateofBirth], Date) Then


Me.lblBirthdayToday.Visible = True
Me.OLEBirthdayCake.Visible = True

Else
Me.lblBirthdayToday.Visible = False
Me.OLEBirthdayCake.Visible = False

End If

Else
Me.lblBirthdayToday.Visible = False
Me.OLEBirthdayCake.Visible = False

End If


End Sub


Thanks in advance.
 
Back
Top