Send Email using VBA

D

David

Hi,

Could someone tell me how to send an email from Access 2007 using VBA. I
want to have users notified of a new record in the database after an access
form has been filled in. I believe that I have to create the code for an
After Update event.

Looking forward to your input
 
D

Dirk Goldgar

David said:
Hi,

Could someone tell me how to send an email from Access 2007 using VBA. I
want to have users notified of a new record in the database after an
access form has been filled in. I believe that I have to create the code
for an After Update event.


The statement to send an e-mail is, basically,

DoCmd.SendObject <various arguments>

You'll find the details in the online help. Note that although the method
is designed to send any of various types of Access objects in the e-mail,
you don't actually have to send any object; you can just send an e-mail
without an attachment. The only problem with this method is that the Access
user will have to confirm the sending of the e-mail, as a security mesasure.
There are some ways around this, but they're a bit complicated -- for more
information, you can refer to Tony Toews' web page on the subject,
http://www.granite.ab.ca/access/email.htm .

The form's AfterUpdate event sounds like the right event for what you
describe.
 
D

David

Thanks for the quick reply Dirk,

I have created a Macro using the SendObject command, you are right that I
can send an email without an object but access asks for permission first.

This is a complete pain as I need it to send automatically without any user
intervention, I went to the site you suggested but could not see anything
there.

Can anyone else give me any more pointers.

Thanks
 
D

Dirk Goldgar

David said:
Thanks for the quick reply Dirk,

I have created a Macro using the SendObject command, you are right that I
can send an email without an object but access asks for permission first.

This is a complete pain as I need it to send automatically without any
user intervention, I went to the site you suggested but could not see
anything there.


I think this page on that site discusses the problem:

http://www.granite.ab.ca/access/email/outlook.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top