General :: Access 2010 - Email Records In Body From Table
Oct 1, 2013
I've set up a piece of VBA code to loop through and email various recipients data, in the form of records within the email body. This works fine, but occasionally produces an error whereby the email output body lines are duplicated spuriously. This only seems to happen when running a large number of email loops.
The data source for the email body content is a table, which for each 'loop' is refreshed with new data by 1) deleting records from that table, and then 2) appending data to the table.
The portion of code for the loop & email:
Do
'Build outputbodytext
DoCmd.OpenQuery ("EmailQ2")
DoCmd.OpenQuery ("EmailQ1")
'set up email
Set rec2 = CurrentDb.OpenRecordset("outputbodytext")
strSendTo = rec2("Email")
i have VBA code to create an email and attach an excel file, what i would like is code to add a report called REPORTMISSINGDATES to the body of the email.
this is the code i have so far, which works and adds everythng i wqant except the main body of the email.
Private Sub Command31_Click() On Error GoTo Command31_Click_Err Dim Email As String Dim name As Variant Dim EMPloy As Variant Dim month As Variant month = MonthName([Forms]![STAFFATTENDANCEMenu]![StaffMonth]) EMPloy = Forms!staffattendancezone!Staff name = DLookup("[STAFFNAME]", "[QRYSTAFFNAME]", "[ASA] = Forms!staffattendancezone!Staff") Email = (Forms!STAFFATTENDANCEAdjust!Email) DoCmd.SendObject acQuery, "STAFFATTENDANCEZONECheckEmployee", "ExcelWorkbook(*.xlsx)", [email], "", "", "" & "Attendance Errors", "THIS IS WHERE I WANT THE REPORT TO GO" _ End Sub
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'm working on a vacation/time off tracker and was hoping to use the collect data feature. I've created a form where a user submits their requested date and number of hours, at which point I'd like the form to be sent to their manager for approval. The manager's email address is stored in a table. Once the manager marks yes or no, I'd like that reflected in the time off requests table, and an email sent to the requester letting them know if it was approved or not. Is this possible? How would I go about it. I'm pretty new to Access, learning on the fly, but I'm pretty good at modifying code to match my situation/working backwards if you have any examples for me to look at.
I would like to automate the current process of sending an e-mail with a PDF attachment that is unique to each recipient; it is their test results. I'm sending an e-mail one at a time (which was fine when the number of folks being tested was small, but now I'm up to approximately 200 e-mails and growing each year)
System Environment:
Windows 7 SP1 (64 bit) Office 2010 Professional
Access environment and Process:
1. A qry object/letter is built based on 4 tables (test results, result averages, a global employee list and location)
2. The Report has both static and dynamic text. Examples include: "Dear" [qry-Letter. F_name] and Address Information
a. =[qry-Letters.F_Name] & " " & [qry-Letters.L_Name] b. =[qry-Letters.Position] c. ="Dept " & Right([qry-Letters.Dept],3) & ", " & [qry-Letters.City]
3. The report also includes the employee's results, the session averages (testing is conducted at multiple locations each occurrence is a session) and companywide averages.
4. Report Process: Run the report, entering primary key Emp_ID, report is populated saved (overwritten with the next Emp_ID and printed as a saved PDF.
5. MS Outlook: create a new e-mail, text body is common to all e-mails e.g. "attached are your test results" the PDF is attached and the e-mail sent to the recipient (the e-mail address follows the corporate standard, =Trim([qry-Letters.F_Name] & "." & [qry-Letters.L_Name] & "@abc.com")
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?
Is there an automatic way of moving the cursor when an outlook email is opened using a VBA event??
Right had a look and haven't managed to google this yet but the background is as follows
I have some code that puts a recordset of people's email into outlook and leaves users with the outlook message open ready for them to append anything they want to the message body.
At the moment the cursor flashes at the very start of the message and users need to scroll down with keys or the mouse to the end before they can add additional text.
I want to automatically move the cursor to the end of the outlook email message opened using a VBA event?
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 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
I have an Access 2010 database connected to several SharePoint lists. I'd like to be able to print a report (based on a query) and add that report as a .pdf attachment to the record I was looking at when I generated the report.
At the moment I can save the report as a .pdf to a local file store, then upload it as an attachment, but is there any way to skip that step and add it to the correct record automatically?
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 MS Access 2010 application when the User opens form CONTACTS Form
◦User finds single record to be used CONTACTID is identifier to be used for selection ◦User clicks button to open form frm_MAIL_MERGE ◦Frm_MAIL_MERGE has a drop down combo box that reads the folder location where the application resides and displays all .DOTM files (that is all template files) and one more combo box which contains the CONTACTID. ◦User selects single .dotm file for merge ◦Frm_MAIL_MERGE has either drop down to select CONTACTID or UNBOUND data field for user to type in CONTACTID number ◦User enters CONTACTID to be used for the mail merge ◦User selects SUBMIT ◦Application merges selected .dotm file with the information in table CONTACTS for the selected CONTACTID ◦Merged document is saved on the user Desktop as xxx.docx
Is it possible to have a value in an excel 2010 cell be used to update an access 2010 db?
For example, if in a spreadsheet "test" cell A2=3 then in a db "test" a column "value" is 3. However, if the value in the spreadsheet changes so does the db.
I wish to work in Access 2010 with a subset of my Outlook 2010 contacts (all desktop- no network barriers), so I am exploring the Desktop Contacts DB found in Microsoft's templates. It passes contact data back and forth using the standard macros, but I wish to add more fields from Outlook. It seems I need to find the code associated with the macro. I believe I can solve the problem using a Linked table, but am wondering if there is another solution?
Calendar synchronization is another issue. Linking gets me to the Archive Calendars, but not the Current one in Outlook which is what I want.
I have an Access 2010 database .. and will be adding about 25,000 records a day to it. So it will get pretty big fast .. so 9 million a year. Is this too big for Access ?? Or is it more a issue of file size .. I know that Access 2010 can go up to 2 GB. I am interested in how I can maximize my performance and not have the database.The data is as follows .. One table. The other tables will be small, just this one will increase in size really.
Id .. Autonumber (primary key) When .. datetime Radio .. integer (indexed .. w duplicates) Group .. integer (indexed .. w duplicates) Type .. text 4 TransType .. text 2
I am considering a purge of old records if needed .. like only keeping the most previous 5 million records or some reasonable number. Like .. then I would think I should try to number my records backwards (using long int rather than autonumber and number records backwards on import) .. ie record 1 would be the most recent one and only keep the last X number of them for performance reasons.
I would like to update the following code I have been using to send emails, from Access 2010 via Outlook 2010, to include my signature block with hard returns in between each line and a few above the signature.
Lets say the signature would be: My Name My Company Name My phone number My Reference
I tried next to: stMessage = Me![EmailMessage] &"My Name" & Chr(10) & Chr(13) & "My Company Name"
etc.
It does not work..
Here is the coding :
Code: Private Sub SendEmail_Click() On Error GoTo ProcErr Dim stLinkCriteria As String
I'm attempting to use Access to automate reporting emails and I'm trying to identify the best way to identify if the report is NULL (blank).
VBA: (strReportName is set to the report. Employees is set to the Employee Name. Email is set to the employees email address. [Requested By] is the column in the report that is used as a filter. The code is functional but also emails reports that are blank. I'm trying to just send the ones that have data) ...
We are currently using Access 2007 and I've got a database that sends emails out to multiple users depending on the data that was entered. We are about to upgrade to Access 2010 and I am testing it now. I was originally getting runtime error '287' when I was adding addresses to a Recipient object. I got past that by adding the addresses in a string and concatenating. Now I'm getting the error with .Send.
I created a Tracking System and would like to send an automatic reminder to the person the ticket has been assigned to, using the due date and the text message in the field "reminder message". Once the message send, I want the database to recognize and not send it again. I want the database to send a new message if the due date has changed.
I would like to use the "Collect and update via email" function within MS Access 2010 which sends out and collects emails. I know how to use this function, but what I would like to do is something slightly different. Instead of emailing out a data entry "form" that has the employee/team member enter information for data collection purposes about their project, status, start date, end date, priority, tasks, etc. Instead, I would like send an Excel/Access table with all of the current project information displayed in the email data collection form and then have the employee reply to the email and overtype edits to displayed information and then have those changes automatically entered into my table. For example, one project table can have up to 50 rows and then column headers such as project status, start date, end date, priority, task description, etc.