Managing Dynamic Emails in EMailDatabaseObject Macros

Jonny

Registered User.
Local time
Today, 04:10
Joined
Aug 12, 2005
Messages
144
Managing Dynamic Emails in EMailDatabaseObject

I have a query that alerting once an employee has a birthday.
Now I wish that "..wishes" report will be sent to that employee.

I can put in AutoExec only static email , a@b.com but not relevant employee email from a table..
 

Attachments

  • Capture.JPG
    Capture.JPG
    67.1 KB · Views: 126
Last edited:
Hi. I think what you’ll have to do is use SetLocalVar and maybe use DLookup or SearchForRecord to get the email from the table. You can then use the LocalVar in your macro.
 
Hi. I think what you’ll have to do is use SetLocalVar and maybe use DLookup or SearchForRecord to get the email from the table. You can then use the LocalVar in your macro.
Could you please help with the syntax? The DB is attached.
 

Attachments

Could you please help with the syntax? The DB is attached.
Hi. Unfortunately, I'm not really good with macros. Would you like to have a VBA solution instead?
 
Yes, sure.. please.
Okay, you could try the following:
Code:
Dim strEmail As String


strEmail = Nz(DLookup("e-mail","Query1"),"")


DoCmd.SendObject acSendNoObject, , , strEmail, , , "Subject", "Message Body", True
 

Users who are viewing this thread

Back
Top Bottom