Currentdb.Execute - Return Error if SQL does not process
Posted on 2009-02-11
I'm trying to run some INSERT and UPDATE queries using CurrentDb.Execute. I've noticed a problem, however... if there is an error in the SQL and the SQL cannot be processed, there's no way that I've seen to trap the error. If I use DoCmd.RunSQL instead, I can see the error message if SetWarnings is set to True; but not if it's set to False. I don't want an access message popping up in my application regardless, though.
Is there any way to trap errors when CurrentDb.Execute does not execute my SQL properly? I want to be able to notify my users that the information did not save, and I'm using a custom (unbound) form that runs multiple INSERT/UPDATE queries when the save button is clicked.