Auto birthday reminder in access 07

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sachuchem22
    New Member
    • Nov 2015
    • 39

    Auto birthday reminder in access 07

    Hi
    I am Created student database in i want to set birthday reminder at my main form when i open my database and also i want to send pre-composed msg to student mail id who birthday are today.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Is Microsoft Outlook your E-Mail Client?

    Comment

    • sachuchem22
      New Member
      • Nov 2015
      • 39

      #3
      No i am not using outlook.

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Assuming you have a Table named tblStudents with Fields [First Name]{TEXT}, [Last Name]{TEXT}, and [DOB]{DATE/TIME}, the following Code in the Open() Event of the Form will notify you of any Birthdays as well as no Birthdays on any given Date.
        Code:
        Dim MyDB As DAO.Database
        Dim rst As DAO.Recordset
        Dim strBuild As String
        
        Set MyDB = CurrentDb
        Set rst = MyDB.OpenRecordset("tblStudents", dbOpenForwardOnly)
        
        With rst
          Do While Not .EOF
            If Format$(![DOB], "mmm dd") = Format$(Date, "mmm dd") Then
              strBuild = strBuild & ![First Name] & " " & ![Last Name] & vbCrLf
            End If
            .MoveNext
          Loop
        End With
        
        If strBuild = "" Then
          MsgBox "No Birthdays for " & Format$(Date, "mmm dd") & "!", vbExclamation, "No Birthdays"
        Else
          MsgBox Left$(strBuild, Len(strBuild) - 2), vbInformation, "Birthdays on " & _
                 Format$(Date, "mmm dd")  'Remove ending CrLf
        End If
        
        rst.Close
        Set rst = Nothing

        Comment

        • sachuchem22
          New Member
          • Nov 2015
          • 39

          #5
          Thanks adezil.
          but to which form either mainform or another form based on tblstudent code will used.

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            to which form either mainform or another form based on tblstudent code will used.
            The choice is yours, whichever is more appropriate.

            Comment

            • sachuchem22
              New Member
              • Nov 2015
              • 39

              #7
              ok Thanks adezil i will try.

              Comment

              • sachuchem22
                New Member
                • Nov 2015
                • 39

                #8
                Thanks Adezil it works perfectly. And soory for late to rply..

                Comment

                • ADezii
                  Recognized Expert Expert
                  • Apr 2006
                  • 8834

                  #9
                  No problem, glad it worked out for you.

                  Comment

                  Working...