Managing Dynamic Emails in EMailDatabaseObject Macros (1 Viewer)

Jonny

Registered User.
Local time
Today, 19:37
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: 75
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 10:37
Joined
Oct 29, 2018
Messages
21,358
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.
 

Jonny

Registered User.
Local time
Today, 19:37
Joined
Aug 12, 2005
Messages
144
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

  • test1.accdb
    596 KB · Views: 86

theDBguy

I’m here to help
Staff member
Local time
Today, 10:37
Joined
Oct 29, 2018
Messages
21,358
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?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:37
Joined
Oct 29, 2018
Messages
21,358
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

Top Bottom