Modern Error Handling in Access

Modern Error Handling in Access

At IJYI we’re proud of our flexibility about the technology we support. That said remotely supporting legacy systems such as Access provides its own unique headaches.

There is nothing worse than hearing “it doesn’t work” without knowing where or how the system failed. Loggly provides a means of finding these details with a consistent view of logs / error reports, and best of all its free for the initial level of usage.

There are a number of different log sources out of the box  with loggly including its own clients for windows server and a .net client library. In this instance though we're talking talking about Access which doesn't support referencing certain external libraries, essentially Access is still working on the bad old days of COM. So to ensure we could pass data from Access we integrated with the http log endpoint. Access dowesn't support calling a HTTP endpoint out of the box to do that we used VBA-Web (https://github.com/VBA-tools/VBA-Web). This combined with the http end point source means you can send errors or any kind of log from Access. 

Below is the error handler code we use:

Note how simple it is to build up the request that gets sent to loggly, whilst I wish I could take credit for this, it is all thanks to the VBA-Web library.

To use the error handler defined above we followed the following pattern. Adhering to VBA standards for error handling the following is setup in each VBA method:

As painful as VBA can be using loggly or other online tools can really help when finding problems in the code.

About the author

John Nicholson

John Nicholson

Director

Experienced Developer / Architect with a background in consultancy working with public and private sector client including Local Government Ombudsman, Legal Ombudsman, Virgin Atlantic and Willis Group

Microsoft Certified TrainerALMMicrosoft Certified Solutions Developer: Web ApplicationsProfessional Scrum Master

Read More