Link to home
Start Free TrialLog in
Avatar of Tracy
TracyFlag for United States of America

asked on

Prevent users from stopping queries to import data in Access

Hi All,

I have an Access 2010 database that is split.  When it is launched in the morning, it checks to see if new data has been imported for the day, if not it runs a few queries, using DoCmd.OpenQuery to import the data.  The problem I'm having is that the users are pressing and holding escape to stop the import from happening.

How can I prevent them from stopping the import when they press and hold escape?

Thanks,
Tracy
SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
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
ASKER CERTIFIED SOLUTION
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 Tracy

ASKER

Thank you both.  Both options work.

With Rey's, if I click escape to cancel the import, it will capture the errors below (am I missing any?) and then I can handle them as needed.

error 3059 - operation canceled by user
error 2501 - the openquery action was canceled

With Crystal's, I had to move some code around, because if I hold escape for long enough (ie, continue holding after it's set back to true in the code), I get an error saying an object is not available (it's trying to refresh a subform on the main form which is launched from the splash form).  

Thanks a lot!
Avatar of Tracy

ASKER

Thank you very much!
Avatar of crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access

you're welcome ~ happy to help