1
votes

I use a scheduled task to run an Access 2007 macro to email via Outlook, multiple Access reports in notepad, Excel 2003 and html formats. around 50% of the time, the Access app crashes and automatically restarts and repairs itself and creates a backup … What can I do prevent the app from crashing?

I don’t know if it is relevant to the problem or not , but the only VBA in the app is to prevent the macro from emailing empty reports, if there are zero records in the report’s data-source query. I set this up in the reports’ properties/event/ “on no-data”/even procedure (Option Compare Database

Private Sub Report_NoData(Cancel As Integer)

End Sub)

Thank you very much in advance for your help, Nathaniel

1
Well, first of all you have no code in your NoData event. 2nd of all, if we could see the rest of your code that does the e-mailing, that may help.Scott Holtzman

1 Answers

1
votes

Is it failing when your repor doesn't have data? In the NoData event, you need to set Cancel=True so that the report stops if there's no data. The code that opens the report needs to trap for that error and handle it accordingly (not send the email).

Sending emails via Outlook can be troublesome with the MAPI security issues. I use the add-in Total Access Emailer from FMS to automate my emails from Access. It lets you attach reports to your messages filtered for each person in the list: http://www.fmsinc.com/MicrosoftAccess/Email.asp

Hope that helps.