Access Macro and Scheduled Task

J

Jale Dones

All,


I thought I should pat myself on the back since I got a macro in access
running. Then I scheduled it to run every 15 minutes from within Windows.
Now I get an error when the macro tries to close Access.

The Error:

You can't exit Microsoft Access now.

If you're running a Visual basic module that is using OLE or DDE, you may
need to interupt the module.


You used a method of the DoCmd object to carry out an action in Visual
Basic, but then clicked Cancel in a dialog box. For Example, you used the
Close method to close a changed form, then clicked Cancel in the dialog box
that askes if you want to save the changes you made to the form.

Anyone have an idea what is causing this? My macro uses RunCode (below),
OutputTo (To save a report to HTML files and Quit to close Access.



Public Function RemoveOldReport(strOutputFileName As String) As Boolean
' Removes previous version of EfilesSummary Report on
\\my_location\EfilesSummary.html

On Error GoTo Err_RemoveOldReport

If Dir(strOutputFileName) <> "" Then
Kill strOutputFileName
End If

Exit_RemoveOldReport:
RemoveOldReport = True
Exit Function

Err_RemoveOldReport:
RemoveOldReport = False

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top