Macro's to E-mail auto name selection

  • Thread starter Very Basic User
  • Start date
V

Very Basic User

Hello,

I've finally figured out how to generate an E-mail from a specific record in
a form. I created a macro (SendObject) to send a mail to people following an
update to the form. I'm wondering if I can have the Macro determine who to
generate the e-mail to based off of the current form. For example. One form
will deal with a plant problem. The other tabs are working through root cause
analysis of the problem. The person working on the problem is called the
"AUTHOR" the person reviewing the information is called the "GATEKEEPER" Each
name are entered into a record for that specific problem. When teh autor
updates the form, I want both the author and gatekeeper to get the e-mail
versus just a standard group of people.
 
W

Wayne-I-M

Hi

Sorry but not too sure about macros (don't use them often). But it's quite
simple to code the sending of a report to multiple people - as long as both
people's email address' are shown somewhere on the form
I have used the names
[EMailField] and [CCEMailField] as an example below


You could use something like this

Private Sub SomeField_AfterUpdate()
DoCmd.SendObject acReport, "ReportName", "RichTextFormat(*.rtf)",
Forms!FormName!EMailField, , "", "E Mail Subject", "E Mail Body", False, ""
End Sub

You would need to have at least a few fields on your form such as the email
address' that you want to send the emails to

Notes on the small bit of code above
If you have problems post back and someone should answer

Private Sub SomeField_AfterUpdate()
This is afterupdate of some field or you could only use a button, on form
load,
etc whichever is most appropriate for your use

"ReportName"
You would need to create a filtered report that would be emailed - note this
would be "attached" to the email if you use the code above.

"RichTextFormat(*.rtf)"
This is the format of the report in the code (for MS Word) you can change
this if you want

*************
The next "bit" will allow you to send your report to multiple people

Forms!FormName!EMailField
You need to show the email address that you want to send the report to
Forms!FormName!EMailField, , "",
Note the space between the , , after the word EMailField. In this space you
could
insert another address if someone needs a CC of the Mail like this

Forms!FormName!EMailField,Forms!FormName!CCEMailField , "",

The 2 controls (they are the boxes on your form) are called [EMailField] and
[CCEMailField] of course you can alter this

"E Mail Subjectâ€
This is text the is in the e mail subject line

" E Mail Body "
This is text in the body of the e mail

You will need to do some work to produce the filtered report and ensure the
form has all the required fields but this should set you in the right
direction

Good luck - hope this helps
 
V

Very Basic User

This is great, thank you for your help!
--
Thank you for your time!
John


Wayne-I-M said:
Hi

Sorry but not too sure about macros (don't use them often). But it's quite
simple to code the sending of a report to multiple people - as long as both
people's email address' are shown somewhere on the form
I have used the names
[EMailField] and [CCEMailField] as an example below


You could use something like this

Private Sub SomeField_AfterUpdate()
DoCmd.SendObject acReport, "ReportName", "RichTextFormat(*.rtf)",
Forms!FormName!EMailField, , "", "E Mail Subject", "E Mail Body", False, ""
End Sub

You would need to have at least a few fields on your form such as the email
address' that you want to send the emails to

Notes on the small bit of code above
If you have problems post back and someone should answer

Private Sub SomeField_AfterUpdate()
This is afterupdate of some field or you could only use a button, on form
load,
etc whichever is most appropriate for your use

"ReportName"
You would need to create a filtered report that would be emailed - note this
would be "attached" to the email if you use the code above.

"RichTextFormat(*.rtf)"
This is the format of the report in the code (for MS Word) you can change
this if you want

*************
The next "bit" will allow you to send your report to multiple people

Forms!FormName!EMailField
You need to show the email address that you want to send the report to
Forms!FormName!EMailField, , "",
Note the space between the , , after the word EMailField. In this space you
could
insert another address if someone needs a CC of the Mail like this

Forms!FormName!EMailField,Forms!FormName!CCEMailField , "",

The 2 controls (they are the boxes on your form) are called [EMailField] and
[CCEMailField] of course you can alter this

"E Mail Subjectâ€
This is text the is in the e mail subject line

" E Mail Body "
This is text in the body of the e mail

You will need to do some work to produce the filtered report and ensure the
form has all the required fields but this should set you in the right
direction

Good luck - hope this helps




--
Wayne
Manchester, England.



Very Basic User said:
Hello,

I've finally figured out how to generate an E-mail from a specific record in
a form. I created a macro (SendObject) to send a mail to people following an
update to the form. I'm wondering if I can have the Macro determine who to
generate the e-mail to based off of the current form. For example. One form
will deal with a plant problem. The other tabs are working through root cause
analysis of the problem. The person working on the problem is called the
"AUTHOR" the person reviewing the information is called the "GATEKEEPER" Each
name are entered into a record for that specific problem. When teh autor
updates the form, I want both the author and gatekeeper to get the e-mail
versus just a standard group of people.
 

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