Macro for sending emails (1 Viewer)

czinker

Registered User.
Local time
Today, 18:02
Joined
Feb 26, 2015
Messages
19
I created a macro in a form to send a report based on a query. I'm looking for a way to auto populate the email address field in outlook based on the query.

Thanks
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:02
Joined
Aug 30, 2003
Messages
36,118
I don't use macros, but you can see if a DLookukp() in the address argument properly populates the address.
 

czinker

Registered User.
Local time
Today, 18:02
Joined
Feb 26, 2015
Messages
19
Would you use DLookukp() in a form or the query? I'm afraid if I put it in the Macro, it will just show "DLookukp()" as the email address
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:02
Joined
Aug 30, 2003
Messages
36,118
You're afraid it would, but didn't test? I did, it returned the email address.
 

czinker

Registered User.
Local time
Today, 18:02
Joined
Feb 26, 2015
Messages
19
I tested it but exactly what I thought happened. How did you test it?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:02
Joined
Aug 30, 2003
Messages
36,118
With an = at the beginning. ;)
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:02
Joined
Aug 30, 2003
Messages
36,118
Happy to help and welcome to the site by the way!
 

czinker

Registered User.
Local time
Today, 18:02
Joined
Feb 26, 2015
Messages
19
Here's the problem I have now...

=DLookup("Due_Diligence_Email", "Docs Request", "Sheet1.ID = 1")

This is tied to form with a drop down box that gets the data from a query. If I have 1, then it only works for that 1 selection. How do I get it to just use the active record in the query?
 

czinker

Registered User.
Local time
Today, 18:02
Joined
Feb 26, 2015
Messages
19
Nevermind I got it!

=DLookUp("[Due_Diligence_Email]","Docs Request")
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:02
Joined
Aug 30, 2003
Messages
36,118
What you posted will return the first record found in the query. If that's not okay, you likely want the method in the link.
 

czinker

Registered User.
Local time
Today, 18:02
Joined
Feb 26, 2015
Messages
19
That's what I want, the first record in the query. All the drop down box does is populate the query with the selected info.
 

czinker

Registered User.
Local time
Today, 18:02
Joined
Feb 26, 2015
Messages
19
pbaldy,

Do you know how to ignore duplicates from a table and only show one record in a combo box?

Thanks
 

Attachments

  • Capture.PNG
    Capture.PNG
    2.1 KB · Views: 113

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:02
Joined
Aug 30, 2003
Messages
36,118
Normally I'd get the selections from a table that only had one record each, but you can use

SELECT DISTINCT FieldName
FROM TableName

or

SELECT FieldName
FROM TableName
GROUP BY FieldName
 

Users who are viewing this thread

Top Bottom