Link to home
Start Free TrialLog in
Avatar of LeLeBrown
LeLeBrown

asked on

Access 2010 step in macro fails

I have a macro in Access 2010 with several queries. One query has a ODBC connection. when the connection fails for any reason, I want to do something else. Is there a way to detect a failure of a specific query in a macro and do something if it fails or would I have to create a stand alone macro and see if the macro itself fails?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LeLeBrown
LeLeBrown

ASKER

Hi Jeff,

Thanks for the response. I ended up doing something in VBA like your example.
To explain further:
I have one query that depends on a ODBC connection that creates a Access local table. If the connection is not available (which seems to happen with some frequency), I don't want my code to stop(because it runs on its own - set up as a task in task manager). I created a macro to run this query and called it from VBA. If it fails (I don't care why), I run another macro that makes a table based on the old data copied from the previous day(that doesn't rely on the odbc conn).
OK, so if my post helped you in some way, then I am happy
;-)