Hello,
My idea: run a access file that would check if someone makes birthday on today's day. And if yes, then a Happy Birthday e-mail would be sent automatically to that person e-mail.
Reality:
Now, I have the following Database:
1 Table - t_User (Name, Birthday, E-mail address)
1 Query - q_Aniv
1 Form - f_Aniv
For the Query, i have:
SELECT t_User.Name
FROM t_User
WHERE (((Month([Birthday]))=Month(Date())) AND ((Day([Birthday]))=Day(Date())));
For the Form, i have:
Private Sub Form_Open(Cancel As Integer)
Dim email As Long
On Error Resume Next
Err.Clear
If Me.RecordsetClone.RecordCount > 0 Then
MsgBox "Today's birthday"
Cancel = True
email = Shell("""C:\Program Files (x86)\Microsoft Office\Office16\Outlook.exe"" /f c:\temp\Aniv.msg")
Else
MsgBox "Nobody does birthday"
Cancel = True
End If
End Sub
So, with this i run the Form and my E-mail message template is open if i got someone who makes birthday today, but i'd like to fill the To field with the e-mail address from the Table t_User before send it, is it possible?
Or can i create a replica of the e-mail message in the Form and have a "Send" button to send the e-mail directly, after checking if someone does birthday "today"?
The body of the e-mail is a image, and i'd like to keep it, if possible.
Thank you!