Create Email From Access W/Information From Form or Query in

  • Thread starter Thread starter mmatzke
  • Start date Start date
M

mmatzke

I have designed Databases for many years now, but never attempted this:

I need to know how to create an email with information located in the active
form or off of a query. I would like to have the email automatically
generated with the To Address, The Subject Line and the Body of the Text. I
would like that email to open but not to send until the operator has a chance
to make modifications. (one record per email).
 
Hi Mark,

You could try the following to start:

Place a button on a form and place the following behind the on click event

Dim objApp as New Outlook.Application
Dim objMail as Outlook.MailItem
Dim objRecipient as Object


Set objApp =CreateObject(“Outlook.Applicationâ€)
Set objMail = objApp.CreateItem(olMailItem)

With objApp.CreateItem(olMailItem)
.recipients.add ([Your field here]) '-> could be the textbox on the form
.cc=â€[your field here]†'-> in case of multiple like this "a;b;c" where
a = name of
cc, b=name of cc and so on
.subject=[Your field here] '-> or subject between " "
.body = “bodytext of mail†'-> or [your field]
.attachments.add etc……
.display ‘-> If you want to see it
.send ‘-> if you want to send it.

End With

Remember when using Outlook automation from Access when trying to send mail
you will get a warning stating someone is trying to send mail do you wis to
continue. This is an Outlook security issue and must be solved with
redemption. Look for the thread in this NG where this has been discussed
before.


hth
 
That totally makes sense, but this is a working system in use, I will try
this overnight. Thanks so much!
--
Mark Matzke


Maurice said:
Hi Mark,

You could try the following to start:

Place a button on a form and place the following behind the on click event

Dim objApp as New Outlook.Application
Dim objMail as Outlook.MailItem
Dim objRecipient as Object


Set objApp =CreateObject(“Outlook.Applicationâ€)
Set objMail = objApp.CreateItem(olMailItem)

With objApp.CreateItem(olMailItem)
.recipients.add ([Your field here]) '-> could be the textbox on the form
.cc=â€[your field here]†'-> in case of multiple like this "a;b;c" where
a = name of
cc, b=name of cc and so on
.subject=[Your field here] '-> or subject between " "
.body = “bodytext of mail†'-> or [your field]
.attachments.add etc……
.display ‘-> If you want to see it
.send ‘-> if you want to send it.

End With

Remember when using Outlook automation from Access when trying to send mail
you will get a warning stating someone is trying to send mail do you wis to
continue. This is an Outlook security issue and must be solved with
redemption. Look for the thread in this NG where this has been discussed
before.


hth
--
Maurice Ausum


I have designed Databases for many years now, but never attempted this:

I need to know how to create an email with information located in the active
form or off of a query. I would like to have the email automatically
generated with the To Address, The Subject Line and the Body of the Text. I
would like that email to open but not to send until the operator has a chance
to make modifications. (one record per email).
 
Cheers ;-)
--
Maurice Ausum


That totally makes sense, but this is a working system in use, I will try
this overnight. Thanks so much!
--
Mark Matzke


Maurice said:
Hi Mark,

You could try the following to start:

Place a button on a form and place the following behind the on click event

Dim objApp as New Outlook.Application
Dim objMail as Outlook.MailItem
Dim objRecipient as Object


Set objApp =CreateObject(“Outlook.Applicationâ€)
Set objMail = objApp.CreateItem(olMailItem)

With objApp.CreateItem(olMailItem)
.recipients.add ([Your field here]) '-> could be the textbox on the form
.cc=â€[your field here]†'-> in case of multiple like this "a;b;c" where
a = name of
cc, b=name of cc and so on
.subject=[Your field here] '-> or subject between " "
.body = “bodytext of mail†'-> or [your field]
.attachments.add etc……
.display ‘-> If you want to see it
.send ‘-> if you want to send it.

End With

Remember when using Outlook automation from Access when trying to send mail
you will get a warning stating someone is trying to send mail do you wis to
continue. This is an Outlook security issue and must be solved with
redemption. Look for the thread in this NG where this has been discussed
before.


hth
--
Maurice Ausum


I have designed Databases for many years now, but never attempted this:

I need to know how to create an email with information located in the active
form or off of a query. I would like to have the email automatically
generated with the To Address, The Subject Line and the Body of the Text. I
would like that email to open but not to send until the operator has a chance
to make modifications. (one record per email).
 

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

Back
Top