I'm strictly a newbie, but I have both Access and Outlook and when I want
Access to send an email I used code like this:
Set ol = CreateObject("Outlook.Application")
Set eml = ol.CreateItem(0)
eml.To = "(e-mail address removed)"
eml.CC = "(e-mail address removed)"
eml.Subject = "Subject of email"
eml.Display 'I think is like setting Visible to True
When I'm sending HTML email I have to search for a particular spot in my
default HTML email and insert my text there, possibly with futher HTML code
embedded. Once I've figured out I can simply set eml.HTMLBody. But for
system notifications I imagine plain text is good enough, so you'd probably
use this:
eml.Body = "This is the text of the email."
eml.Attachments.Add "C:\Path\Filename.xls", olByValue
eml.GetInspector.Activate
Attachments are optional, of course. The Activate method, if I remember
correctly, activates that screen so I can look at it, modify whatever I want
to and then send it manually; no doubt you can add code to the above to send
it automatically if that's what you want.
Now, I know there are simpler things you can do to send email NOT using
Outlook. I'm not an SMTP geek, though; probably others can improve on the
above.