Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending e-mail from access - what is a template file

Status
Not open for further replies.

scottian

Programmer
Jul 3, 2003
955
GB
when sending an e-mail from access
there is a bit in the list constants and methods which allows for a 'Template File' does anyone know what this is, and how i create one

Be ALERT - Your country needs Lerts
 
You would use an HTML Template file if you were sending your email in the acFormatHTML output format. The HTML Template File is used as a way of pre-formatting your document with such things as a background color or company logo. The Template File is saved on your computer or on a network shared folder with the .html extension. In the docmd.sendobject you would reference the HTML Template with the actual name of the file in quotes. Below is an example of a template file. Of course you need to modify it for your purposes.

<HTML>

<!--The following token places the object name in the title bar of the Web browser.-->

<TITLE><!--AccessTemplate_Title--></TITLE>

<!--The following HTML tag creates a different background color than the Web browser default.-->

<BODY BACKGROUND = &quot;gray.jpg&quot;>

<!--The following token places all object output inside the <BODY> tag.-->

<!--AccessTemplate_Body-->

</BODY>

<BR><BR>

<!--The following four tokens create four navigation text buttons that jump to the first, previous, next, and last pages of a report.-->

<A HREF = &quot;<!--AccessTemplate_FirstPage-->&quot;>First</A>

<A HREF = &quot;<!--AccessTemplate_PreviousPage-->&quot;>Previous</A>

<A HREF = &quot;<!--AccessTemplate_NextPage-->&quot;>Next</A>

<A HREF = &quot;<!--AccessTemplate_LastPage-->&quot;>Last</A>

<!--The following token inserts the text &quot;Page n&quot; , where n is the current report page number.-->

<P ALIGN = CENTER>Page <!--AccessTemplate_PageNumber-->.</P>

<!--The following HTML tag adds a company logo to the bottom of the Web page.-->

<IMG SRC = &quot;company_logo.jpg&quot;>

</HTML>


 
Ok thanks for the tip, but unfortunately you have now answered my question with &quot;not possible&quot;. my company wont allow me to create a web page.
so heres some more information on what i need and hopefully someone will have the answer.
i have a front end and backend database, the front end is input only and allows users to raise queries which are passed to a small department, to action, however on some occassions the queries arent necessary or require further information. what i need to do is allow the small deprtment staff reject the request directly back to the originator for further clarification.
I have been trying to use outlook to trigger an email, but im tied up in knots. I also need some advice on how i can populate the fields of the outlook form with the data from the initial request.

Be ALERT - Your country needs Lerts
 
Hey scottian, I just finished dealing with a similar problem last week. I have email going both to the person/department being notified, and an email coming back with their acknowledgement. Really simply, I just used the form fields to populate the emails and it is really working smoothly. (However, this will only work if your user's are using Outlook) Here's what I did for the acknowledgement with some proprietary stuff removed, hope you get some ideas for your own project...


Private Sub cmdSaveAREntry_Click()
DoCmd.RunCommand acCmdSaveRecord
' Emails Auditor with notice that responsible party entered response to Action Request
'Dimension message and prepare application
Dim strEmail, strBody As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Set objOutlook = CreateObject(&quot;Outlook.application&quot;)
Set objEmail = objOutlook.CreateItem(olMailItem)
' Prepare message
strEmail = Me!
strBody = strBody & &quot; *** This Message Has Been Generated By The Operations Database *** &quot; & Chr(13) & Chr(13)
strBody = strBody & &quot; *** ACTION REQUEST &quot; & Me![InspectionNumber] & &quot; HAS BEEN RESPONDED TO *** &quot; & Chr(13) & Chr(13)
strBody = strBody & &quot;The responsible party has entered a response to the Action Request listed below.&quot; & Chr(13)
strBody = strBody & &quot;The Cause Analysis and Action Plan have been entered by the Responsible party into the database.&quot; & Chr(13) & Chr(13)
strBody = strBody & &quot;Action Request#: &quot; & Me![InspectionNumber] & Chr(13)
strBody = strBody & &quot;Responsible Party: &quot; & Me![Responsibility] & Chr(13)
strBody = strBody & &quot;Auditor: &quot; & Me![AUDITOR] & Chr(13)
strBody = strBody & &quot;Findings: &quot; & Me![Issue] & Chr(13)
strBody = strBody & &quot;Containment: &quot; & Me![Containment] & Chr(13)
strBody = strBody & &quot;Due Date: &quot; & Me![Date Due] & Chr(13) & Chr(13)
strBody = strBody & &quot;*** RESPONSE ***&quot; & Chr(13) & Chr(13)
strBody = strBody & &quot;Root Cause: &quot; & Me![Root Cause] & Chr(13)
strBody = strBody & &quot;Action Plan: &quot; & Me![Action Taken] & Chr(13) & Chr(13)
strBody = strBody & &quot;Please contact Responsible person/department listed above with any questions.&quot; & Chr(13) & Chr(13)
strBody = strBody & &quot;*** End Message ***&quot; & Chr(13)
With objEmail
If Not IsNull(Me![Email]) Then
.To = strEmail
End If
.Subject = &quot;*** Action Request Response Entered & Returned For AR#&quot; & Me![QAR Number] & &quot;***&quot;
.CC = &quot;whoyouwant@your.com&quot;
.Body = strBody
.Importance = olImportanceHigh
If Not IsNull(Me![Email]) Then
.Send
'Show confirmation message
Dim Confirm
Confirm = MsgBox(&quot;Action Request Response Entered&quot;, vbInformation)

End If
End With

' Resets email variable
Set objEmail = Nothing


Exit Sub

End Sub


chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top