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.
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)
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.
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...
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.
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)
................................................ 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?
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?
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.
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"
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.
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.
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
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.
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'
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.
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
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.
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
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.
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".
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
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:
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?