Using an Access Email to kick off an Access Database macro

lykaon78

Golden Member
Sep 5, 2001
1,174
9
81
About 5 times a week I get a specific email that kicks off a 4 day process. On each day of that 4 day process some manual intervention is required on my part. Some of that work is work in a reporting database.

I'm basically wanting outlook to kick-off a procedure that will run in access to take care of that reporting work.

Anyone done something similar to this? Any tips?

I'm accomplished enough in VBA and Access to program all the routines I need to run to complete all the reporting work in Access but I'm just having trouble figuring out how Outlook can tell Access to start that routine.

Any help is appreciated.
 

Cogman

Lifer
Sep 19, 2000
10,278
126
106
If there is any way to schedule this (first monday of the month stuff?) then that would be a better approach than relying on outlook.

If the email is manually generated, you are sort of sunk (unless the person writing you truly only ever writes you to let you know that it is time to kick off the 4 day process). You can look for key words in the email, but ultimately you don't want the 4 day process kicking of because someone replies with the right combo of words to make it happen.

If the email is automatically generated, then this shouldn't be too bad to deal with. I would suggest looking here for how to get started. (look at the top answer, ignore the rest).

http://msdn.microsoft.com/en-us/library/ee814736.aspx

This should be a good place to get started.

http://msdn.microsoft.com/en-us/magazine/cc301799.aspx

This should also help.
 

lykaon78

Golden Member
Sep 5, 2001
1,174
9
81
If there is any way to schedule this (first monday of the month stuff?) then that would be a better approach than relying on outlook.

If the email is manually generated, you are sort of sunk (unless the person writing you truly only ever writes you to let you know that it is time to kick off the 4 day process). You can look for key words in the email, but ultimately you don't want the 4 day process kicking of because someone replies with the right combo of words to make it happen.

If the email is automatically generated, then this shouldn't be too bad to deal with. I would suggest looking here for how to get started. (look at the top answer, ignore the rest).

http://msdn.microsoft.com/en-us/library/ee814736.aspx

This should be a good place to get started.

http://msdn.microsoft.com/en-us/magazine/cc301799.aspx

This should also help.

Thanks, I will start there. The email is automatically generated but based on the email receipt of a fax. Fortunately it will be very easy to identify the email when it arrives.
 

KLin

Lifer
Feb 29, 2000
29,501
126
106
You should look into using vba code in outlook to evaluate the subject line of incoming emails. If a match is found, have the vba method open up access and run the reporting database. You can set a macro to start up automatically as soon as an access database file is opened.
 

Tweak155

Lifer
Sep 23, 2003
11,448
262
126
This thread inspired me to write something like this at my work. I got it working already.

It works somewhat how KLin describes but instead of opening Access I just query the DB through VBA and return the results via the body of the e-mail as the 2 links above go over.

My method:

Read subject of e-mail only
Look for indicator characters that this is a query (for me I surround by % symbols)
Use what is in between the % symbols as my query data (this is a unique key for me)
Query the DB's and format the body of the return e-mail based on data retrieved.

I can now get information on tickets via e-mail from anywhere rather than using our company's GUI. Suhweet.
 

KLin

Lifer
Feb 29, 2000
29,501
126
106
This thread inspired me to write something like this at my work. I got it working already.

It works somewhat how KLin describes but instead of opening Access I just query the DB through VBA and return the results via the body of the e-mail as the 2 links above go over.

My method:

Read subject of e-mail only
Look for indicator characters that this is a query (for me I surround by % symbols)
Use what is in between the % symbols as my query data (this is a unique key for me)
Query the DB's and format the body of the return e-mail based on data retrieved.

I can now get information on tickets via e-mail from anywhere rather than using our company's GUI. Suhweet.

Very nice.
 

beginner99

Diamond Member
Jun 2, 2009
5,223
1,598
136
Or you could just schedule the report to be run everyday say at 8:00 am assuming that is feasible performance wise. Then you will always already have the report once the mail arrives.
 

WannaFly

Platinum Member
Jan 14, 2003
2,811
1
0
This thread inspired me to write something like this at my work. I got it working already.

It works somewhat how KLin describes but instead of opening Access I just query the DB through VBA and return the results via the body of the e-mail as the 2 links above go over.

My method:

Read subject of e-mail only
Look for indicator characters that this is a query (for me I surround by % symbols)
Use what is in between the % symbols as my query data (this is a unique key for me)
Query the DB's and format the body of the return e-mail based on data retrieved.

I can now get information on tickets via e-mail from anywhere rather than using our company's GUI. Suhweet.

Just be sure to sanitize/parameterize(is that a word?), even though its for your own person use, an email with the subject of:
Hi, how are %you'; delete from users; --%
could be very dangerous.
 

Evadman

Administrator Emeritus<br>Elite Member
Feb 18, 2001
30,990
5
81
Just be sure to sanitize/parameterize(is that a word?), even though its for your own person use, an email with the subject of:
Hi, how are &#37;you'; delete from users; --%
could be very dangerous.

I use the same process that Tweek155 uses, except I have the process hooked to many database systems. Instead of having the query in the body of the email, I put it in an attachment. The body of the email specifies:

The system to run the query against
If the query is DDL or a result set is expected
If a result set, the return type (text/excel/whatever file, name, delimiters, encryption process to use, etc)
The return location (email, ftp, share, etc)
Time to run the query if not immediate

I use a process to make sure that the email is actually one that should be processed and passed on that is beyond using the '%' characters. To simplify, the email must be in an exact format along with passphrases that only I know. Since email is basically unencrypted, I use a rotating passphrase that changes based on several factors including the time, day, month, year, source email, destination system, database user, and past queries. The passphrase changes for each run, and is never the same. I only get 1 chance to enter it correctly each time, or all subsequent attempts are ignored until I reset the system.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |