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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generating Email in Access 1

Status
Not open for further replies.

NebraskaGod

Technical User
Apr 12, 2001
9
0
0
US
Is it possible to automatically generate an email based on certain criteria in the form when the form is completed?
 
You can use the DoCmd SendObject method in VB code. If you use Outlook for Email, you may want to use Outlook objects. I have created module you can download from the following page.

Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Hi Terry,

Looks great, but being a novice, I don't know what to do with this page of code.

I assume that I need to put it in a form... I've got fields on the form for email addresses from one of my tables... don't know how to link those to this though.

An example would be helpful.

Thanks!
 

You would put the code in a module in the Access database. Open the database, click on Modules and select new. Paste the code into the module and save it. Do not use the same name as any of the functions.

You can then call the function from the form event such as a button click. Here is a simple example.

Dim strRetMsg As String, strSubj As String
Dim strMsg As String, strEmail As String

strSubj = "Important Message"
strMsg = "The payroll process has completed."
strEmail = "John@Email.com"

strRetMsg = SendMessage(True, strSubj, strMsg, strEmail) Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top