Modules & VBA :: Using Query To Put Data In Email Body?
Apr 22, 2015
I'm trying to put multiple records of data from a subform in a single e-mail, and my Outlook calendar. I have a contracting business, and on my Orders form (which details a single client), I have a sub-form that lists all the items to be done at that client's home (a different record for each work item). When I send an e-mail, or post the appointment to the Outlook calendar, I am trying to list all those records in the body of the e-mail, and/or in the Notes section of the appointment. I created the query to call the records, but have not figured out a way to use it in the code.
I have a query table in Access 2007 with requests pending an individuals review and approval. I would like to create an automatic email each day to that individual which includes the actual query table impeded as part of the body of the email (not as an attachment).
I have created some code to get the records of a query and it puts them in the body of the email but it doesn't format it well for example the email looks like
James | halliwell | 31 Leanne | smith |27 Alexis | smith |8
I would like it to be in a table is this possible,
Code: Public Function SendEmail() Dim MyDB As DAO.Database Dim rst As DAO.Recordset Set MyDB = CurrentDb
With the code below , I send the report: “ESERT4H”, in email body. How I could add yet another report on the same body of the email ?
DoCmd.OutputTo acOutputReport, "ESERT4H", "HTML(*.html)", "D:Access empESERT4H.html", False, "", 0, acExportQualityScreen Dim Out As Outlook.Application Dim NS As Outlook.NameSpace Dim Folder As MAPIFolder Dim Mens As MailItem
I currently have a form with the below fields (example names)
FRMFormName001
Field001 Field002 Field003 Field004
RPTReportName001
Once the info is filled out we click a button that converts it into a report and once the information is confirmed correct you have to click another button Email it off, this is currently done by a macro creating the report as a attachment PDF File.
The system has now changed and they now want the details in the body of an Email, is it possible to make the details be copied straight into an Email body by a simple macro button click or similar?
I have a query where I collect data for different vendors and their purchase orders, products deadlines etc.
Is it possible via access to generate a report and via outlook send in the email body a message where is showing the purchase order date of delivery and priority? Or can that be done via a form?
With this very simple command, I have the ability to send emails to several clients, reporting many things, quotations etc.
Private Sub Command84_Click() DoCmd.SendObject , , , , , , "SOMETHING", [SalesGroupingField] & "" & [1], True, "" End Sub
Now, i want, on the body of the emai, to display many records, it is from Nothwind, how can i display on the body of the email all records from this report?
I am attempting to modify some code that is used for reading content in an Outlook mail and need to catch and move the email if certain content is duplicated in the email.
The code reads the email that is in the attached image format:
As seen, this email contains 2 devices, but the Serial No in both is duplicated.
In the code, I need to capture this and rather than reading the contents, I need to just move this email to a separate "Manual" folder to be dealt with separately, so not to write the information to the database.
The current code is as follows:
Option Explicit Private ns As Outlook.Namespace Private sEmailAddress As String Private sPerson As String Private dReceived As Date
I have developed a private sub which automatically creates an email when a button is pushed.
The code is working well, but I need to insert Carriage Returns in the Body Text of the email just before the word "Please" where it appears in two places. Is this possible?
I have the following string of text that I currently push out to the body of an Outlook email (using the DoCmd.SendObject function with an Access report):
Which is great and works fine! It appears in the email like so:
Original.PNG
Now, it has been requested that the data to be left justified to the widest line... so, in this scenario, it would look like this:
Edit.PNG
I've searched for ways this might be accomplished so it's always left justified to the widest line, but haven't come across any definitive solutions yet.
I am sending an email from a button, and it runs a word merge and then attaches that word document and two others two an email. All that works fine, but in the body of the email the carriage return is not working.
I've tried "vbCrLf", "Chr(13)" and "Chr(10)". but none of them are working in this email. I use vbCrLf all of the time in many other emails and it works fine.
Code:
Public Function SendEmailFinancial() Dim MessageBody, vAttach1, vAttach2, vAttach3, vTo Dim appOutLook As Outlook.Application Dim MailOutLook As Outlook.MailItem
[Code] ...
This is what the email is looking like when it comes out:
Project ID: 2013YG00229 Project Title: Toolbox Talks Construction Safety Guides and Mobile App Program Manager: Shana Peschek I am attaching three (3) forms that are needed in order for the State of Washington to process grant payments for your organization for the purposes of carrying out the activities outlined in your final approved application.
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.
I almost have what I need, but I am not quite there. I am a VBA novice and need help. I couldnt understand some of the code I have searched for on this topic.
I have a query that returns exactly the results I want. By using a SendObject macro I can accomplish sending the message with a .txt file attached. What I want to do is instead of having the attachment I want to send my query "FaxReportQueryReport" in the body of the email. No set address, just a set RE: line of "Today's Deliveries".
I have a subform in Continuous Records format (records displayed are determined by controls on the parent). I would like to create a button that prepares an email and copies the contents of that subform in to the body of an email message.
The email. I have a method to create a new email, set To, CC, Subject and even Message Text.
Code: strTo = txtName strCC = txtManager strSubject = "Something" strMessage = "Hi, please find below list of details from X Y and Z" & vbnewline & vbnewline
That all works. Thats fine
The Records: I have found ways to have them added as an attachment, either the the SendObject and OutputTo method but I would like the list of records to be converted to a text string so I can include it within my strMessage variable, not include it as an attachment.
Code: strMessage = strMessage & "Subform Records to go here"...
I want to automate an email to include the senders email addres with some text in the body of the email.
Code: Private Sub send_mail_Click() Dim olApp As Object Dim objMail As Object On Error Resume Next 'Keep going if there is an error Set olApp = GetObject(, "Outlook.Application") 'See if Outlook is open
I have a form which has a button to email the data out in a standard email message.
Private Sub Command60_Click() Dim MyDb As dao.Database Dim rsEmail As dao.Recordset Dim sToName As String Dim sSubject As String Dim sMessageBody As String
[code]...
This works well enough, however, FIELDS 11 through to 16 contain the venue address. This is all we ll and good if every field of the venue address is populated. here are times when not all of the fields are populated, for instance, the address might only be 5 lines.I know I can do this using IIf statements on a report, but how can i achieve the same thing for the email.
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 a database to send e-mails from access trough Outlook. The issue is that I would like the body of the e-mail to have hyperlinks, colours, bolds and that I can get it from plain text.
This is the code I have:
Dim MyDB As Database Dim MyRS As Recordset Dim MyTable As Recordset Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment
[Code] ....
How can I make the body to be HTML format, or, can I have a e-mail template storaged in my PC and then indicate to use it whenever the e-mail is sent?
I made a form in Acces now i want to make a button in that form that if a user click on it it wel open a new email message with the form in it.. so NOT if a attachement but directly in the email body.
I'm sure there is a way to do this true vba or something else...