SendObject Macro with form data in subject line & body

Neobeowulf

Registered User.
Local time
Today, 11:48
Joined
May 31, 2012
Messages
34
Team,

I'll try to explain this as best I can. I want to put a button on my form that sends an email that pulls data from the current record i'm on.

Example: I'm on Mr. Smiths record. My button should send an email with
Mr. Smiths name in the subject line. His name is the data I want my email to pull.

So, when I click the button, my user who sent the late report should get an email that says (roughly)

To:
From:
Subject: (This is where I want the data from the record i'm on)

Body: Blah blah blah (name again) report is late blah blah blah
 
I'm not sure if it works in a macro, but you can try putting a form reference in the subject argument:

Forms!FormName.ControlName

replacing the form and control names with yours. It is certainly doable if you use VBA code instead.
 
Nah that didn't work in a macro. It just shows up like you typed it in. [Forms]![Decor6].[Name]

I'm not good with VBA at all, i'll keep researching.
 
In VBA it would look like:

Code:
DoCmd.SendObject , , , [Forms]![Decor6].[Name], , , , , True

You can build a string of fixed text and data from the form:

Code:
strBody = "Blah blah blah " & [Forms]![Decor6].[Name] & " report is late blah blah blah"
DoCmd.SendObject , , , [Forms]![Decor6].[Name], , , , strBody, True

VBA help should give you more info on the available arguments.
 
I found some code that I think you posted in another thread. I'm tinkering with it now.
 

Users who are viewing this thread

Back
Top Bottom