Download Sample Access File: MS Access Vs MS Outlook
MS Access is a database based program, but MS Outlook is communication program of sending and receiving mail. MS Access can be programmed to work with MS Outlook by sending data in Access to another user via email. It can also set task due to another from data in the Access tables.
There are two MS Access Files in this download zip file:
- Access Vs Outlook
- Format HTML Body Email
File 1 -Access Vs Outlook
Highlight functions or features in this sample file include:
1. Email Files from the List Box. Selecting file manually from any folder and adding them to the list box. Then send those files from list box to the customer selected from the dropdown box. From the example below, three files are added on the list box and customer Paul Smith is selected to be emailed to. After clicking “Send Email”, Outlook will display with three files attached and ready to send to email of Paul Smith.
- Set Task in Outlook for yourself. Select task and Click on Set Task in Outlook button. The task detail will be set in your Outlook as programed under the Click Event Procedure. You can copy and modify code for your program as your want.
- Set Task to Other Users. We can set task to a specific employee that selected from the dropdown list. If employee has an email address then the task will be set to that employee as shown below.
One task can also be set to multiple recipients. For instance, if there is no specific employee assigned to this task then the task will be sent to all employees who have the email address on the employee table. The code below is using the Do Until loop to add all employee emails to the list.
- Attach PDF file to Email. After a customer name is selected on this form and click Email PDF button, as coded, the email will display and ready to send to that customer that has an email address. If the customer has no email address the message will pop up. The location of PDF file can be modified as needed.
- Send Email to One Customer. The search form is used to search for customer name and can email for that customer by clicking on email button corresponding to the customer name. In this example, you will learn how to send email to customer and also how to create search form by keyword. For instance, click on email button for Masters Bob the Outlook will display new email ready to send to Masters Bob.
6. Send Email to Multiple Customers. Email can be sent to many customers who have email address listed on Access form. For example below, the list of customer with customer type of Individual will display on the subform after the Individual customer type is selected from combo box. Click on Send Email button to send email to these customers on the list. If there is no customer type is selected email will be sent to all customers who have emails per coding behind the Send Email button.
- Convert Access Report to PDF and Attach to Email. a) I have a Customer List report shown below. However, I want to send this report to all customers I will click on Email button without selecting any customer from the list. VBA will convert a report to PDF file and save it to computer and will remove it from computer after sending to customers successfully.
b) If the customer name is selected from a dropdown list and click Email button, a new Outlook email will be sent to only the selected customer. For instance below, the email with attached file will be sent to Paul Smith only when Paul Smith is selected.
8. Attach Signature to Email with Message Body. At first, you have to set the Signature for your email in Outlook. The signature should always attach to your new email automatically. However, you will need to program in Access VBA to attach that system Signature to your email under the Click Event Procedure of the “Email with Signature” button in Access as shown below.
Download file contains:
6 tables, 3 queries, 11 Forms, and 1 Report
File 2 -Format HTML Body Email
1) Form Task Due: This file is an additional file that shows how to format the email body for Outlook. It has only one form that will use to attach some information from this form with the email. Task #5 is selected on this form then click on “Send Email.”
It will open MS Outlook ready to send email to other the html formatting on the email body.
The picture below is showing the example of formatting text.
- Text bold
- Use tab in a line
- Color the text
- Underline the text
- Highlight the whole row
- Color background the whole row
- Link to URL address
2) Form Table Format: This form will demonstrate how to put information from Access form inside the table on the email body. The other types of format also are included within the table. Task #4 is selected on this form then click on “Send Email with Table formatting.”
It will open MS Outlook ready to send email to other the html formatting on the email body.
The picture below is showing the example of formatting the table in email body.
Table formatting with:
- table width = 500
- colspan or Merge two columns on first row
- center text on first row
- set columns width = 300 and 200
- set table cellpadding = 5
- border =1 with cellspacing =0
- text color on first column = blue
- font text on first column = bold
- color background the whole row
- link to URL address outside of table