Access Crash Reporter

If you have worked with users for a while you have probably found out that they are not always the most reliable source of information for details on error reporting.

If you (the developer) are sitting in the same building, they might just swing by, or have you come take a look at their monitor. But what if they are in another building, or another city? Well a few options could occur:

  • They never report the error to you and just continue to try to use the program, but eventually get tired of getting the same error and blame you, even though they actually did not do anything to give you a chance to correct the error.
  • They send you an email or phone you up, and this might be an example of the dialogue to take place:
    • User/Client: “Hey Developer, we had an error”.
    • Developer : “Okay, can you tell me what the error number was?”
    • User/Client: “I think it started with a 6, or maybe a 7″
    • Developer: “Hmm. ok, what were you doing at the time?”
    • User/Client: “I was working in the tool”
    • Developer “Yes, but which screen or form were you using?”
    • User/Client: “The one with the big textbox for details!”
    • Developer: “Okay, what did you do right before the error occurred?”
    • User/Client: “I was browsing the internet”
    • Developer: “I meant in the application”
    • User/Client: “Oh, I think I was updating a customer record”
  • (rare) They take a screenshot and write a detailed error report saying what they were doing, and include relevant details about the error number, error description and what else they might have been doing just before.

Now imagine how nice it would be if every user did option 3. But wait, what if we could help turn regular users into those super users? 
The good news is that, now you can! With this free piece of software you can now present a pretty looking error form and AUTOMATICALLY generate detailed and useful error reports including screenshots of all open forms and the application (while not invading privacy of anything else).

ErrorReporterFormScreenshot
Example of the form (You can customize this of course)

Below here, you can see a small extract of the information gathered by the error handling tool. It gathers loads of info, but I have tried to prioritize the most important bits at the top.

Example of error report:

Error ID:F9AE94266E3943DBB1D664959A33868F
==== Error Message as presented to user ====
Error 91 has occurred in procedure [cmdCauseError_Click] in module [TSC_ErrRep_frm_Test_ErrorReportTool]
Object variable or With block variable not set
This error was raised in order to test the Error report functionality
==== Error Number ====
91
==== Error Line (0 if N/A) ====
0
==== Error Description ====
Object variable or With block variable not set
==== Error in Module ====
TSC_ErrRep_frm_Test_ErrorReportTool
==== Error in Procedure ====
cmdCauseError_Click
==== Session Information ====
==== Application Information ====
Name : TSC_ErrorReporter – BETA.mdb
Path : C:\Users\Documents\Applications\ErrorReport\TSC_ErrorReporter – BETA.mdb
Active Form : TSC_ErrRep_frm_Test_ErrorReportTool
Active Control : cmdCauseError
Parent Form(if any) : TSC_ErrRep_frm_Test_ErrorReportTool
Active Datasheet : N/A
Active Report : N/A
Open forms : TSC_ErrRep_frm_Test_ErrorReportTool
==== Access Info ====
Version : 14.0
Build : 6024
Fileformat : 10
DB Version : 4.0
==== Time of Error ====
15-03-2013 15:01:55
==== Windows User Name ====
aec
==== Active Form ====
TSC_ErrRep_frm_Test_ErrorReportTool
==== Active Control ====
cmdCauseError
==== Active Control Parent Form ====
TSC_ErrRep_frm_Test_ErrorReportTool
==== Active Data Sheet ====
N/A
==== Active Report ====
N/A
==== All Open Forms ====
TSC_ErrRep_frm_Test
==== Application Version ====
1.0
==== TheSmileyCoders Crash Reporter Version Info ====
1.0
==== Application Version ====
1.0
==== Minutes application has been running ====
157
==== Hours since last Windows reboot ====
7

What else can it do?

All error information is also stored in a table. This table can be local or networked. The error report is of course error resistant so even if no connection is available to the network, the reporter will continue, and store all the information into a text-based log file, which can be emailed along with the screenshots to your preferred email!

Email Options

TheSmileyCoders Crash Reporter is setup to use either Outlook or CDO (with Gmail). To use the built in CDO you need to have a Gmail account set up that you can use for this purpose, however if you are more experienced in CDO, you should be able to setup the Crash Reporter to use other email accounts. Screenshots and error log are automatically attached.

That sounds expensive!

Nope, I have chosen to provide this tool absolutely free of charge, under the Creative Commons 3.0 license. For more details see http://creativecommons.org/licenses/by/3.0/. This means that you may use, alter, copy, redistribute and include this code in your application, provided that you include the attribution details specified in each module.

Why is that? Well, maybe I could sell this tool for some nice money, but the fact is that I want to give something back to the Access community which has helped me learn and evolve to the point where writing such an application is possible, and also because I would rather see my hard work being put to good use, and I am not big on marketing. But hey, when that first error report ticks into your mailbox, if you find my Crash Reporter useful, why not drop a thank you comment on my blog? Those comments are the real return-value for me.

Setup and Use

For setup information, you can watch this YouTube video, and/or read on:

Before you start using the Crash Reporter, you need to modify the following settings found in the TSC_ErrRep_Main module. I have highlighted the areas that need to be set if you use Outlook as your email client.

‘***************************************************************************************
‘ – Err reporter settings
‘***************************************************************************************
‘Place YOUR email here, the email which the reports should be sent to
Public Const gReportErrorToEmail As String = “YourEmail@SomeWhere.com”
‘Place the name of your application in here. It will be used in various message boxes and captions
Public Const gAppName As String = “TheSmileyCoders Report Tool”
‘Place the name of your company, or your own name here
Public Const gDeveloperName As String = “TheSmileyCoder”
‘Choose whether to use Outlook or CDO for mail
Public Const gUseOutlook As Boolean = True
‘Place details on the Gmail account for which to use CDO to send error message
Public Const gSendUserName As String = “”
Public Const gSendPassword As String = “”
‘Set whether or not to take a screenshot, and whether to include it per default
Public Const gTakeScreenshot As Boolean = True
Public Const gDefaultSubmitScreenshot As Boolean = True
‘Whether or not to dim the background as the submit error form is opened
Public Const gDimBackground As Boolean = True ‘Default is true
‘Version of Error report tool in use
Public Const gErrorReportToolVersion As String = “1.0”
If you want to use CDO instead, so you don’t have to rely on the user having outlook installed, you can modify the following settings:
‘Choose whether to use Outlook or CDO for mail
Public Const gUseOutlook As Boolean = False
‘Place details on the gmail account for which to use CDO to send error msg
Public Const gSendUserName As String = “YourExtraEmail@gmail.com”
Public Const gSendPassword As String = “YourPassword“

I would suggest not using your own gmail, but creating a Gmail account specifically for this purpose.

Now with the settings in place, you need to import all the objects from the sample database, into your application. The only object that is not required is the test form. Once imported, start by checking that it compiles fine within your environment, by selecting Debug->Compile in the VBA editor. Then you need to look at your error handling procedures, and modify them to use the error report tool. Now if you already have error handling code, it might look something like this:

Private Sub YourCode()
On Error goto ErrHandler

 'Some code

ExitSub:
  Exit Sub

ErrHandler:
  Msgbox Err.Number & " - " & err.Description
  Resume ExitSub

End Sub

Now instead of that plain old message box saying there has been an error, you can now use the Error reporter. Simply replace the MsgBox line with:

TSCs_ReportUnexpectedError "Name of your procedure", "Name of module or form", "Custom info"

and the tool will handle the rest, including taking screenshots, preparing the error report, and opening the error report form.

Summary

In this blog post I presented my new Crash Reporter. With this you can easily get much more detailed and useful information when a bug/error occurs in your software, and users get presented with a much nicer looking custom form, instead of the plain old windows message box.

The download comes with a test form, so you can start experimenting with the Crash Reporter today!

5 Replies to “Access Crash Reporter”

  1. Hi Anders

    We discussed the differences between our error reporters a couple of years ago.
    Mine had email built in. Yours had screenshots.
    Very pleased to see you’ve since added email capability to your crash reporter
    Its a great tool

    1. Thank you. As I recall the tool always had email built in. Maybe your thinking of someone else?

  2. Under “Setup and Use” you state ” I have highlighted the areas that need to be set if you use Outlook as your email client.”, actually nothing is hilighted here. Also several of your Public Const declarations are repeated, e.g. gSendUserName appears twice. But it appears to be a nice tool which I look forward to investigating further. Thanks for sharing!

  3. Hi, This looks like a great tool. Thanks so much for making it available freely!
    I am trying to use it with an Office 365 64-bit installation and it needs to be modified for operation under 64-bit VBA. Have you already made those changes?
    If not, I will do so and send you my results.
    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.