Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subject line of an email message through code 1

Status
Not open for further replies.

NC1977

Programmer
Nov 26, 2007
22
CA
Good morning,

I have a form, with a command button that once clicked sends my report directly to the users email so that he or she can email this report.

The following is my code:
DoCmd.SendObject acSendReport, "Requete Lawson", , "xxxx.xxxx@lakdsjfl.com", , , Forms![Requete Lawson]![Mandat]

this part "Forms![Requete Lawson]![Mandat]" which is the subject line of the email needs to be dynamic... I want the subject line in the email to be filed with whatever is in the text box: "Forms![Requete Lawson]![Mandat]"

This doesn't work and I was wondering if it's even a feature????

Thank you
 
This should work, however you may need to save the record before running this code. It would be best to include an output format.
 
This doesn't work
What happens ? Any error message ? Unexpected behaviour ? Computer crash ? ... ?

Anyway, [Requete Lawson] should be an opened form with a populated control named Mandat.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Actually the subject line reads Forms![Requete Lawson]![Mandat]....But I think what Remou said is correct, I should save the record first however, half of my form is bound and the other isn't...I'm not sure how to save my record to a new table and then run the email code all in one command button???
 
If the subject line reads
Forms![Requete Lawson]![Mandat]

Then you must have put it in quotes. You do not show quotes in the code you posted, which is fine. If you still have problems, it is best to cut and paste the code here.
 
Remou it worked! Thank you thank you! wonderful!
 
Last question, I'm trying to set the output format to Rich text format... How do I put it in my code?? I've tried RTF, Richtextformat, rtf, this doesn't work...any ideas???

Thanks
 
acFormatRTF
Should suit.

You can find these answers by clicking on a keyword such as OutputTo in the code window and pressing F1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top