On Error Goto

T

talofer

I have a command button that once clicked on runs a query which eventually
creates a desired error. How do I tell the database to open a specific form
(let call it Form1) once the error happens. THANKYOU FOR YOUR HELP!!
 
A

Allen Browne

If the error occurs because of running the query, use the Execute method
with the dbFailOnError switch, e.g.:
dbEngine(0)(0).Execute "SomeQuery", dbFailOnError

Your code will need to use error handling. If you are not sure how to do
that, see:
Error Handling in VBA
at:
http://allenbrowne.com/ser-23a.html
 
Top