Code for automated e-mails sent via Microsoft Access?

H

Hem13P

I need a solution, either code/ macros, to send an automatic e-mail (from
microsoft outlook) once a form has been filled in, or by a button on the
switchbord manager which can send multiple messages for a number of different
forms. Each form will contain dates and information which will be different
to each other, hence the e-mail cannot be generic. Help please!! Thanks in
advance.
 
J

Jeff C

You can use the "sendobject" command/macro to do this..if you do a search on
this in the "macro" section there are a number of posts which already have
the sample code and instruction on how to tie it with a command button. I
was able to follow the posts and do it just last week.
Something like

DoCmd.SendObject acsendreport, strDocName, acFormatSNP,strEmail,,,,,,,
 
H

Hem13P

Any chance you can send me the code from your database? I think i have found
what you advised, but just to make sure! Thanks for your help. Much
appreciated
 
J

Jeff C

This is the code I put in the "OnClick" property of the command button:

DoCmd.SendObject acSendReport, "1_arptqryNextMonth", acFormatSNP,
[CboEMail], , , "Report Of Those Needing PPDs Next Month", , True

You will need to play with this to discover for yourself what happens but in
a nutshell
you are activating the "sendobject" command
telling it to send a report
note the comma
telling it what report to send (note quotations)
telling what form to send
[cboEmail] refers to a combo box I have tied to a table of email adresses
where I choose whom to send to
note all the commas in between each comma is the cc and bcc etc

You can follow the prompts for the sendobject macro and relate what goes in
between each comma...the true at the end allows you to edit the e-mail before
sending, false makes it an automatic send. If you get a warning about
something sending something in your outlook, go to outlook and security and
make it low to get rid of the warning

Good Luck
 
Top