Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help. Trapping Errors. 1

Status
Not open for further replies.

thebernieb

Programmer
Jun 6, 2001
15
US
I'm trying to write an error trapping routine in VBA for Access 97 and am having a few problems. I want to log the errors in a table titled "ErrorLog". That's no sweat. Now I can easily put the error number, source, and description in the table, but what about the actual module, procedure, and/or line that the error occurred in. If my application fails on the user end, I can't expect the user to click debug and tell this information for me. So if anyone has any suggestions as to how I can return strings with containing the code line text, procedure name, and module name where the error occurred, let me know. Thanks!
 
This question comes up occasionally. Nobody has ever figured out a way to get the procedure name, except by writing code that assigns a constant string to a global variable, once per procedure and after returning from each procedure call. That's too much code to be practical.

Nobody has ever figured out how to get the specific source code line at all. The information the debugger uses to find the failing source line isn't available to VBA code.

If you want to review past posts on this subject, try searching the Access forums for "error handling" or "error handler". Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top