Access Automation Question / HELP request

analysis_paralysis

New Member
Joined
Mar 12, 2009
Messages
16
It might be that my brain is just broken these days (haven't been using access in at least a few years so to say that I'm rusty is an undestatement) but I need help setting something up.
Here is what I am trying to do:
I have an excel file that is saved over (using same name) multiple times each day with a cut and paste from a .csv file. I want to have that excel file as a linked file in access and each time the file is saved over for access to run a query against another table to determine matches against a particular field. I then would like the output of that query exported out to excel (to a set folder) and, ideally, an email sent out with the query results as an attachment.
How incredibly difficult would this be? I am in a bit of a crunch and need to figure out how to get it done. Any help would be greatly appreciated and you your status of hero would be completely assured! :) I would also write an epic poem in your honor if you would like :) (joke, but I would do lots of stuff in exchange for this help).
Thanks!
A_P
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Several procedures are required to answer your Questions. Linking Excel File to MS-Access database is not a problem (File - ->Get External Data - ->Link Tables), you can link the Worksheet as a table to your database or directly reference the worksheet data in a Query. Refer the link
Code:
http://www.msaccesstips.com/2008/08/opening-excel-database-directly.shtml
if this method is preferable.

The data change in Excel File can be detected by checking the FileLen(PathName) of the attached file with the value saved during earlier upload event and determine whether new data introduced in the external file or not. This can be either programmed through a Timer-Interval procedure and check every one hour or a preferable fixed interval or you may click a button to run a VBA routine to check, after overwriting the excel file.

If new data found in the external file then your Query linked to the Excel Table in Access can be exported as Output into another Excel file with the following statement:

Code:
DoCmd.OutputTo acQuery, "myQuery", "MicrosoftExcelBiff8(*.xls)", "c:\My Documents\myQuery.xls", True, "", 0
Both event can take place at one click, checking the file change and exporting the result.

For the E-Mail part take a look at the following link to get a general idea as how to go about it:

http://www.msaccesstips.com/2007/11/automated-email-alerts.shtml

VBA Code is available there. You can customize them to your needs.

Regards
 
Upvote 0

Forum statistics

Threads
1,214,419
Messages
6,119,389
Members
448,891
Latest member
tpierce

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top