Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

access macro continue on error

Status
Not open for further replies.

lisat76

Programmer
Sep 25, 2007
89
US
I have a macro that run weekly and is executed from a batch file via windows task scheduler. I am using access 2003

My macro imports several spreadsheets into access.
That all works just fine.
The macro looks in a folder and imports several different excel files into the proper tables.
Sometimes some the excel files are not in the folder because there is no new data to import.
When i run the macro manually and there is not a file
access throws an error saying the file is not there i can click ok and the macro continues the execute the rest of the way. However if the job runs via the taskscheduler and this error comes up it will not skip past it it is waiting for confirmation.

How can i tell my macro to ignore these errors and keep going when they comes up?
thanks
 
put this line at the beginning of the macro

On Error goto ErrorHandler


at the end of the macro add this code


ErrorHandler:
select case err
'select actual codes here by
'case 94: resume (some label_name)
'case 3021: maybe do something different


case else
resume next '<---this says ignore all other errors
end select

hope this helps out

John



 
can yo give me more specific instructions
I think i did it wrong
i created two modules
added your code then at the start of the macro i told it to open the error check module which is
On Error goto ErrorHandler

at the end of my macro i had it open the other module which has this code
select case err
'select actual codes here by
case 3011: resume

case else
resume next '<---this says ignore all other errors
end select


this did not work still ran through and left the error boxes open
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top