Unanswered: How to change Access default error messages?
Hey, I would like to know how I can change Access' default error messages such as "...changes were not successful because they would create a duplicate value in index..." etc. etc. and replace it with something meaningful for the user. I'm looking for general solution not just the one error I mentioned above. THANK YOU
1. create a table of error codes (you may need two or three if you want to handle ADO, DAO, and Access errors). These codes are readily available if you have MSDN.
2. Add a field for your custom message.
3. Write a general error handling function and place it in a public module. The function should be passed the error number and perhaps source and should return your custom message which it looks up in the tables you just created.
4. Put a standard error handling routine in every function and sub procedure which isn't really difficult because you can cut and paste it. Granted this is much easier in a new project than one that already has large numbers of procedures.
With this you can even create more than one possible message and add a switch argument to your error handler that will return the appropraite message depending on the situation.