Forms :: Email Using User Selected HTML Template With Optional Report As Attachment

Jun 27, 2015

I have an access form. It has

-Two textboxes with client first and last name
-Two textboxes with a contact 'email1' and 'email2' for the client
-A combobox with a list of templates to use for the email.
-A checkbox to include a copy of the statement on the email.

I want the user to be able to press a button which does the following

-Sends an email to both 'email1' and 'email2'.
-Attaches a secific report as PDF if the user has selected the checkbox
-The body of the email includes a greeting line using the clients name from the record.
-The body of the message includes below the greeting line a html email template depending on the users combobox selection.

View Replies


ADVERTISEMENT

Gaps In Between Tables On Html Email Template

Sep 21, 2006

my html template is built inside access.. the form button is clicked and the template opens in outlook.

it looks fine in outlook.. so i send the email.. when i receive the email in outlook, it looks fine..

here is what it looks like

http://www.londonheathrowcars.com/image2.jpg

however, i sent the same template to a gmail and hotmail address to see what it looks like..

it looks fine in hotmail
http://www.londonheathrowcars.com/image3.jpg

however in gmail it looks like this..

http://www.londonheathrowcars.com/image1.jpg

now, these gaps are appearing in between tables..

<table>blablabl</table>GAP<table>...

now, my question is.. is there anything i can add to the code that will remove these gaps..
i know my code is messy.. at the moment however it begins with <table> and ends with </table> (the main wrap table)

i realise i may need to add some kind of html type or something, but i dont know what..

as always, if anyone can shed some light on this matter i would be ever grateful..

thank you

below is the code

CODE
Option Compare Database

Private Sub emailbutton_Click()
'References: Oulook Library
Dim strEmail, strSubject As String, strBody As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

strEmail = Me.emailadd

strBody = "<table border='1' width='610' id='table1' cellspacing='0' cellpadding='5' bordercolor='#5A79B5' align='left'><tr><td align='center'><table border='0' width='600' id='table2' cellspacing='0' cellpadding='0'>" & _
"<tr><td width='300' height='61'>&nbsp;</td><td width='300' height='61' align='center'><img border='0' src='http://www.londonheathrowcars.com/emaillogosmall.gif' width='300' height='61'></td></tr><tr><td width='300' height='30'><font size='2' face='Arial' color='#000080'>FAO</font></td>" & _
"<td width='300' height='30' align='center'><b><font face='Arial' color='#5A79B5'>-------- London Heathrow Cars --------</font></b></td></tr></table><table border='0' width='600' id='table3' cellspacing='0' cellpadding='0'><tr><td>&nbsp;</td></tr><tr>" & _
"<td><font size='2' face='Arial' color='#000080'>Thank you for your booking request via our website.<br>Details of the requested transfer and our fare are as follows:</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><hr color='#5A79B5'></td></tr></table>" & _
"<table border='0' width='600' id='table4' cellspacing='0' cellpadding='0'><tr><td width='200' height='20'><font size='2' face='Arial' color='#000080'><b>Job Date:</b></font></td><td width='400' height='20'><font size='2' face='Arial' color='#000080'>&nbsp;&nbsp;This</font></td>" & _
"</tr><tr><td width='200' height='20'><font size='2' face='Arial' color='#000080'><b>Pickup Time:</b></font></td><td width='400' height='20'><font size='2' face='Arial' color='#000080'>&nbsp;&nbsp;This</font></td></tr><tr><td width='200' height='20'>&nbsp;</td><td width='400' height='20'>&nbsp;</td>" & _
"</tr><tr><td width='200' height='20'><font size='2' face='Arial' color='#000080'><b>From:</b></font></td><td width='400' height='20'><font size='2' face='Arial' color='#000080'>&nbsp;&nbsp;This</font></td></tr><tr><td width='200' height='20'>&nbsp;</td><td width='400' height='20'>&nbsp;</td>" & _
"</tr><tr><td width='200' height='20'><font size='2' face='Arial' color='#000080'><b>To:</b></font></td><td width='400' height='20'><font size='2' face='Arial' color='#000080'>&nbsp;&nbsp;This</font></td></tr><tr><td width='200' height='20'>&nbsp;</td><td width='400' height='20'>&nbsp;</td>" & _
"</tr><tr><td width='200' height='20'><font size='2' face='Arial' color='#000080'><b>Vehicle:</b></font></td><td width='400' height='20'><font size='2' face='Arial' color='#000080'>&nbsp;&nbsp;This</font></td></tr><tr><td width='200' height='20'><font size='2' face='Arial' color='#000080'><b>Set Fare:</b></font></td>" & _
"<td width='400' height='20'><font size='2' face='Arial' color='#000080'>&nbsp;&nbsp;This</font></td></tr></table><table border='0' width='600' id='table5' cellspacing='0' cellpadding='0'><tr><td><hr color='#5A79B5'></td></tr><tr><td>&nbsp;</td></tr><tr><td>" & _
"<font size='2' face='Arial' color='#000080'>Our drivers are courteous, experienced and smartly presented. In addition, all of our vehicles are modern, clean and comfortable. To book this transfer, kindly reply to this email or call us on the following:</font></td>" & _
"</tr><tr><td>&nbsp;</td></tr><tr><td><table border='0' id='table9' cellspacing='0' cellpadding='0'><tr><td width='150'><b><font face='Arial' size='2' color='#000080'>Freephone (UK Only):</font></b></td><td width='150' align='left'><b><font face='Arial' size='2' color='#000080'>" & _
"&nbsp;&nbsp;0800 505 3231</font></b></td></tr><tr><td width='150'><b><font face='Arial' size='2' color='#000080'>International:</font></b></td><td width='150' align='left'><font face='Arial' color='#000080' size='2'><b>&nbsp;&nbsp;+44 (0) 208 814 2727</b></font></td></tr></table></td>" & _
"</tr><tr><td>&nbsp;</td></tr><tr><td><hr color='#5A79B5'></td></tr><tr><td><b><font size='2' face='Arial' color='#5A79B5'>Hasan Karim - Operations<br>London Heathrow Cars<br>&nbsp;</font></b></td></tr></table><table border='0' width='600' id='table10' cellspacing='0' cellpadding='0'>" & _
"<tr><td><table border='0' width='325' id='table11' cellspacing='0' cellpadding='0'><tr><td width='75'><font face='Arial' color='#5A79B5'><span style='font-size: 8pt'>Address:</span></font></td><td width='250'><span style='font-size: 8pt; font-family: Arial; color: rgb(90, 121, 181);'>" & _
"&nbsp;&nbsp;Suite 7, Jolyon House, Amberley Way, TW4 6BH</span></td></tr><tr><td width='75'><font face='Arial' color='#5A79B5'><span style='font-size: 8pt'>Phone:</span></font></td><td width='250'><span style='font-size: 8pt; font-family: Arial; color: rgb(90, 121, 181);'>&nbsp;&nbsp;+44 (0) 208 814 </span>" & _
"<span style='font-family: Arial; font-size: 8pt; color: #5A79B5'>2727</span></td></tr><tr><td width='75'><font face='Arial' color='#5A79B5'><span style='font-size: 8pt'>Fax:</span></font></td><td width='250'><span style='font-size: 8pt; font-family: Arial; color: rgb(90, 121, 181);'>" & _
"&nbsp;&nbsp;+44 (0) 208 399 6500</span></td></tr><tr><td width='75'><font face='Arial' color='#5A79B5'><span style='font-size: 8pt'>Web:</span></font></td><td width='250'><span style='font-family: Arial; font-size: 8pt; color: #5A79B5'>&nbsp;&nbsp;http://www.LondonHeathrowCars.com</span></td></tr><tr>" & _
"<td width='75'><font face='Arial' color='#5A79B5'><span style='font-size: 8pt'>Email:</span></font></td><td width='250'><span style='font-family: Arial; font-size: 8pt; color: #5A79B5'>&nbsp;&nbsp;info@LondonHeathrowCars.com</span></td></tr></table></td></tr></table></td></tr></table>"

strSubject = "London Heathrow Cars - Booking Request"
With objEmail
.To = strEmail
.Subject = strSubject
.HTMLBody = strBody
'.Send 'Will cause warning message
.Display
End With

Set objEmail = Nothing
End Sub

View 1 Replies View Related

Modules & VBA :: Email Function Using Optional Parameters - Optional Argument Error

Aug 12, 2015

I keeping getting the error "Invalid use of Null" when i call my email function using optional parameters.

Code:
Email Me.ProjectID.Column(1), _
Me.ProjectAddress, _
Me.TaskDescID.Column(1), _
Me.TaskDescExt, _
strStatus, _
Me.TaskStatusID.Column(1), _

[Code] .....

View 4 Replies View Related

Modules & VBA :: Change HTML Text On Email If Checkbox Selected

Feb 18, 2014

I have the following code which works perfectly BUT I want to be able to add another line of text if users enable a checkbox. I have tried everything I can think of but can't get it to work. When using an "IF check150" statement it just adds the extra text in regardless of selection or not.

Code:

Function Mail_Radio_Outlook6(activedoc As String)
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim acc_req As String
Set OutApp = CreateObject("Outlook.Application")

[Code] ....

This is fine most of the time but If a user ticks check150 I want to add another paragraph.

Do I use an IF statement, if so in what format? is it a separate function etc?

I am slowly getting more familiar with Access but still come unstuck on the simplest of things at times.

View 3 Replies View Related

Modules & VBA :: User Generated Email Template

Jun 11, 2013

I would like to create a table containing email templates for use around various applications and interfaces. I would also like the user to be able to create the text for these templates, but as well as the dynamic text. So a user might create a record as such:

Email_Template_ID: 1234
Email_Name: "Payment notification"
Email_Subject: "Project ID: {Project_ID} - Payment made"
Email_Body:
"Dear {Title} {Surname}
We have recently made a payment of {Amount}. Please check your bank account in the next two days. This relates to Project ID: {Project_ID}, {Project Name}.
Best wishes
Payment Team"

So a user, with sufficient knowledge of certain field names, would be able to drop in the dynamic content as they deem appropriate. The VBA would then replace anything in curly brackets with the genuine field name.

I could possibly start with Replace(Email_Body, "{", "' & [") and repeat it for the end curly bracket, but I'm sure VBA would just render this as Dear ' & [Title] & ' etc. without interpreting it as Dear Mr...

I hope I've explained myself OK. To look at it another way, in Excel there is a function called INDIRECT() which allows Excel to interpret a cell reference as the actual content of the cell...

View 1 Replies View Related

Modules & VBA :: Vanishing Commas When Exporting Report Into HTML Email Body

Jun 17, 2013

I'm running the following code to generate an email from a report.

Quote:

Function ExportHTML3()
Dim strline, strHTML
Dim OL As Outlook.Application

[Code].....

But I don't really know much VBA and I found that code on the internet, so I can't figure out how it's doing that and if I can stop it. Or is there another way to get the text from the HTML file into the Email body, which brings the bold formatting with it, like the following.

Incident Reference: AA99999

View 4 Replies View Related

How To Populate HTML Template Within ACCESS?

Nov 30, 2004

Hello all..
I have an HTML template with about 15 TAGS built in to it..such as:
[SKU]
[MITVALUE_TITLE]
[MITVALUE_ACCESSORY1]
[MITVALUE_ACCESSORY2]
[MITVALUE_ACCESSORY3]
[MITVALUE_ACCESSORY4]
[MITVALUE_ACCESSORY5]
[MITVALUE_ACCESSORY6]
[MITVALUE_ACCESSORY7]
etc. etc. etc...

Now I would like to somehow populate those fields from the tables that i have.. (The all have a common "related" field)

example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style10 {color: #FF0000; font-size: 12px; }
-->
</style>
</head>
<body>
<table width="100%" height="100%" border="0">
<tr>
<th height="23" colspan="2" scope="col">ITEM INCLUDES:</th>
<th width="30%" height="100%" rowspan="4" scope="col"><a href="[MITVALUE_PHOTO5]" target="_blank"><img src="[MITVALUE_PHOTO5]" width=266 height=200 border="6" align="right"></a></th>
</tr>
<tr>
<th width="73%" height="23" colspan="2" scope="col"><p align="center">[MITVALUE_ITEM]</p></th>
</tr>
<tr>
<th width="10%" height="23" scope="col"><div align="left"></div></th>
<th width="38%" scope="col"><div align="left"><font size="2" face="Arial"><b><font color="DADADA" face="Verdana, Arial, Helvetica, sans-serif"><font color="0D4587"> </font><font color="#000099" size="2" face="Arial, Helvetica, sans-serif">[MITVALUE_ACCESSORY1]<br>
</font><font size="2" face="Arial"><b><font color="DADADA" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000099" size="2" face="Arial, Helvetica, sans-serif">[MITVALUE_ACCESSORY2]</font></font></b></font><font color="#000099" size="2" face="Arial, Helvetica, sans-serif"><br>
</font><font size="2" face="Arial"><b><font color="DADADA" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000099" size="2" face="Arial, Helvetica, sans-serif">[MITVALUE_ACCESSORY3]</font></font></b></font><font color="#000099" size="2" face="Arial, Helvetica, sans-serif"><br>
</font><font size="2" face="Arial"><b><font color="DADADA" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000099" size="2" face="Arial, Helvetica, sans-serif">[MITVALUE_ACCESSORY4]</font></font></b></font><font color="#000099" size="2" face="Arial, Helvetica, sans-serif"><br>
</font><font size="2" face="Arial"><b><font color="DADADA" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000099" size="2" face="Arial, Helvetica, sans-serif">[MITVALUE_ACCESSORY5]</font></font></b></font><font color="#000099" size="2" face="Arial, Helvetica, sans-serif"><br>
</font><font size="2" face="Arial"><b><font color="DADADA" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000099" size="2" face="Arial, Helvetica, sans-serif">[MITVALUE_ACCESSORY6]</font></font></b></font><font color="#000099" size="2" face="Arial, Helvetica, sans-serif"><br>
</font><font size="2" face="Arial"><b><font color="DADADA" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000099" size="2" face="Arial, Helvetica, sans-serif">[MITVALUE_ACCESSORY7]</font></font></b></font></font></b></font></div></th>
</tr>
<tr>
<th height="23" colspan="2" scope="col"><span class="style10">THIS ITEM ONLY INCLUDES ITEMS LISTED ABOVE </span></th>
</tr>
</table>
</body>
</html>



................................................
I would like those fields to be put in automatically.. wether they are in a memo field within a table or a field within a query ... it really doesn't matter.... Anyone have any ideas?

Regards,
OvAdoggvO

View 3 Replies View Related

Macro - Output To HTML Using A Template

Apr 4, 2013

In the Macro object 'ExportwithFormat' there is an option to output as an html file. There is also an option to supply a template file. I am not sure how to create a template file for html.How to create this file or point to a resource that will work for me?

View 1 Replies View Related

Forms :: Restrict User Input In Textbox Depending On What Option User Has Selected

May 22, 2013

I am building a form in access and I am trying to find a way where user input isn't possible in the associated textbox when "No" from on option box is selected.

View 3 Replies View Related

Modules & VBA :: How To Save Word Template As HTML

Apr 29, 2014

I'm using the below to merge an access form into a word template (it's a starter for 10).

That works fine. What I need to do is save the word template as HTML so I can then upload it to my website.

Dim wordApp1 As Word.Application
Dim docPath1 As String
Dim fileName1 As String
Dim PageName As String
PageName = Forms!Frm_Page_Create![Page]
docPath1 = Application.CurrentProject.Path & "Merges"

[code]....

View 1 Replies View Related

General :: Create A Forum That Changes Values In A HTML Template

Jul 8, 2014

I Am working on a Access database that will build a excel spread sheet, that will be uploaded to Ebay via file exchange. I am looking to build a forum that will edit parts of a Html text in a column, such as the size and color.

View 1 Replies View Related

Modules & VBA :: Static Webpage Form - Export To HTML Using Template

Mar 12, 2014

In my DB I have a query that I need to create a static webpage from, now in excel I can do the record button and bingo, but access is a lot more confusing.

I have a template named doc_tplt.html that when I do the export from the query it creates the webpage using this template.

I want to have a form with a selection of command buttons on it to export to html using the template for various queries and tables.

What is the VBA code to export the query (qry_docs) and apply the template (doc_tplt.html) and save to the same directory as the DB itself.

View 2 Replies View Related

General :: Making A Report With User Selected Fields

Aug 23, 2013

To start, I am going to generalize to a database of Cows. the fields are:

Name (enforced unique/"Primary Key" in access language?),

size,
color,
age.

The goal is to have a form with check boxes for the fields that the user selects. Scenario is one cow buyer cares about size, while another may care about color and be curious on age. So rather than guessing at what reports the users will want, have a form that allows them to select the fields they want then print a report. An intermediate step would be a query to filter the data.

See the picture below ....

Also, from my perspective, this is the basis of the best code i would write; if someone wanted to add a column for cow gender you wouldnt have to change all your forms/queries/reports:

Global import table.Cows

Form 2 in picture (form with check boxes):
for ( i=0, i<width(Cows), i++)
form.create.checkbox cb.append(i)
cb.append(i).label(Cows[i])

Then create the report based on cb0, cb1, cb2, etc. queries

View 3 Replies View Related

Forms :: Link To Allow User To Navigate From Each Record To Its Respective Attachment

Mar 17, 2015

I am new to Access and I am trying to make a Database. However, I have an attachment with each record and I would like to know if there is a way of making a button/link that will allow the user to navigate from each record to its respective attachment.

View 6 Replies View Related

Reports :: Create A Form Which Filters A Report Based Off Of Combo Boxes Selected By User

Jan 2, 2014

I'm trying to create a form which filters a report based off of combo boxes selected by the user. The code I'm using currently is:

Code:
DoCmd.OpenReport "rptProgramAttendees", acViewReport, , "ProgramIDFK = " & cboProgramTitle

This works great to return a report if the user selects something from the combo box. How do I adapt this so that the user can also leave the combo box blank and filter the report to return all records?Additionally, what if I want to have the user filter between dates selected on the form; i.e. between 'txtStart' and 'txtEnd'

View 10 Replies View Related

Forms :: Block User From Writing In Textboxes If They Have Not Selected A Date

Aug 21, 2014

I have a form that has four textboxes, date dropdown box and a date box. I am trying to get the form to do the following: Block user from writing in the textboxes if they have not selected a date in the date box.

Get the datebox to look at the behide screens records to see if there has already been a documented date (duplicate date) and inform the user that this date has already been used. Then auto them to the date dropdown.

View 2 Replies View Related

Email Attachment

Feb 17, 2007

Hi,
I was wondering if it's at all possible to add an attachment which is a pdf file to an email? I've searched this site and can't seem to find anything on this.
Thanks
Geno

View 1 Replies View Related

Email Attachment

Mar 15, 2007

Hi all,

For my db, which has send object command to send a *.snp report in email object, I want to include some more attachments. On click event should get the files from a local drive and attach to email message along with report.

Could some body help me towards this point?

View 6 Replies View Related

Reports :: Optional Footers On A Report?

Nov 19, 2014

Is it possible to have three different report footers on the same report? I want to show one footer at a time depending on a condition met in the detail section. I already know how to check the condition but I need to know how to do the rest.

Ex:
if condition1 = A then
me!reportfooter_1.visible = true
me!reportfooter_2.visible = false
me!reportfooter_3.visible = false
end if

View 7 Replies View Related

Access Uses HTML To Send Email, Please Help

Aug 29, 2004

I'm updating a database that automatically sends an email to the drafts folder of Outlook. The developer that created the database used VBA code to call html code written in a table. The html code contains the body of the letter. I've figured out most of it but I need to include a date (one month from the current date) in the body of the letter. Unfortunately I've been researching java script and html all weekend and still haven't managed to figure that one out. Can anyone out there help with this? Also is this normal to include html and javascript in Access, I have never seen it before. Are the benefits good? I have serious studying to do if this is the case.

View 1 Replies View Related

Email HTML Body Code

Aug 27, 2015

I can create PDF's, DOCX's retaining the PDF formatting save them back to different network locations and then retrieve and attach to emails that are generated for different areas, however I have been asked to scrap the attachment and insert the content of the attachment directly into the body of the email. I have had a good browse around the net with no real approach. The code below simply gets the recepients email address adds the subject and then is looking for the .HTMLBody which simply comes through in the body as

"O:divAKLResgroupE - ReportsHTML FilesDRAFT TEST .html".

.To = RScoloumdetail(2) ' Gets Email Address
.CC = ""
.BCC = ""

[code]....

View 2 Replies View Related

Send Email Attachment

Dec 8, 2006

I have the following code to send a email with outlook, what I need is to automatically collect a attachment named commissions located in C:document and settings/Documents/...
Private Sub cmdSendEmail_Click()
DoCmd.SendObject acSendNoObject, , , cboEmail.Value, , , "Commission Request", "A new commission request has been submitted."
End Sub

How can I do it??
Thanks

View 5 Replies View Related

Email Table With No Attachment?

Aug 21, 2006

Hello Everyone,


My Situation: I have a form which merges with a table of 123 Names & Addresses. The only thing these records have in common is an ID #. And the name of the company the ID Number belong to.


Now what I need to do is send in an Email the ID# and Company that the ID# belong to.


Here is an example: Toys R US #45

In the records there is "Gi Joy"
"XBOX"


But they all are connected to the #45






When I try to send from the form I get a table as an attachment with all of the records in excel format when using the following code:


DoCmd.SendObject acSendForm, "frmPeople", acFormatHTML, "sample@aol.com", , , "ID# Information"

I need to send just the ID# in a table but not as an attachment in Outlook. I have looked for examples and I seen none anywhere.

If I could just send a table with one row and nothing but the ID# Information, I would be so happy...

View 2 Replies View Related

Email From Access With Attachment.

Aug 16, 2006

Hi all
We have been using
Docmd.Sendobject, "name", acformatrtf, to, cc etc

Is there any way to have a form within access just like a compose format wherein we have option to attach files?

View 8 Replies View Related

Mailmerge Email With Attachment

May 21, 2012

In my database which is used by a charity I have a button which opens a mailmerge email document in MS Word using the following Visual Basic code -

FollowHyperlink "C:Our FoldersBWMCJuly Donors Email.docx", , True, True

This mailmerge document draws its personal information from a query in my database. And sends off personal emails to a number of donors.

I want to attach a personal document called 'Allocations.docx' which is also a mailmerge document drawing its personal information from the same query. How can I automate the attachment of this document to the email so that each donor gets their own email plus their own attachment?

Can something be added to the existing line of VB which will do what I want? If so, what do I need to add?

View 8 Replies View Related

Open An Email Template. Sorry If This Is Easy

Oct 30, 2006

Hi all, I have done a search to try and find an answer to this question but haven't found quite what i'm after.

I have an email template saved and all I need is a (hopefully very simple) command button that when pressed opens the outlook email template.

I don't need any addresses filled in or anything else like that, just the template to open.

Sorry if this is such an easy question to answer but i'm not that great with access but was still asked to find out a way of doing this.

If any better ideas can be suggested please do as i'm open for ideas.

Thanks for any help.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved