Access Crash Reporter

Introduction

Some of you may have heard me talk about this pet project of mine on LinkedIn or elsewhere, and now I am finally ready to share it. This is my crash reporter tool, version 1.0. It has already gone through a lot of changes since the beta version, and I still have features and stuff I wish to add, but I think it is time to start letting others use it. For download links, see the bottom of this page.

 

What is this 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, and 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 your open forms and the application.

Form example:

ErrorReporterFormScreenshot

 

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 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 setup 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 because 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. And if my tool really helped you find and solve a nasty bug, then you can always buy me a beer, by pressing the PayPal donation link.


All donations are welcome, no matter the size.

 

 

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:

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:

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!

Download

Download “TheSmileyCoder's Error & Crash Reporter” TSC_ErrorReporter-V1.1.zip – Downloaded 1015 times – 321 KB

Known Issues

If you are using tabbed forms in your access application the Crash Reporter will sometimes only take a screenshot of the topmost (the visible/active) form.

Version History

1.1 Fixed a bug with screenshots if a form was open in design view. Changed dbOpenTable to dbOpenDynaset for cases where errors are stored in a linked table.

1.0 First release

Author:

19 comments on “Access Crash Reporter
  1. Tom van Stiphout says:

    Great idea. Thank you for sharing.
    I would like to provide some feedback via email. Can you send me your email address?

    Tom van Stiphout
    Microsoft Access MVP

    • TheSmileyCoder says:

      Hi Tom
      Glad you like the idea.
      You can email me at SmileyCoder(do not include this)tools at gmail..com.
      Email is also included in the code in the sample database.

  2. Pat says:

    I don’t see a link to download the tool.

  3. TheSmileyCoder says:

    The link is just below the Download header. No signup or membership is required to download.

  4. Terrence Kuchel says:

    Absolutely love this example, will make life a lot easier with error reporting.

    One quick questions how did you set the code window to be black and green. I know it’s not related to the article just curios.

  5. Seth Schrock says:

    Do you have a list of what code was changed to make version 1.1? I have implemented V 1.0 is a handful of databases and I don’t want to totally wipe everything out and start over “just in case”. I found the difference with the forms in design view, but I don’t know where else the changes were made.

    • TheSmileyCoder says:

      That is a good idea. I don’t have that I must admit. I shall strive to make that in future releases. I believe I made 2 changes. One was to make sure that if the form was open in design view, it would not try to screenshot it. Second was to switch from using dbOpenTable to dbOpenDynaset on the error storage table, in case people were using a networked table to store the information.

      Thank you for your feedback.

  6. Jose Ignacio says:

    This tool is an awesome idea and it works great!

    Thanks for sharing your ideas and professional code.

    This tool also has already the capability super users want to do to these days; Send a report as email body. Instead of building more overhead, or users manually use MS Paint to take a screenshot.

    The idea is that when management receive our reports before or without opening all the attachments, preview the Key Performance Indicators (KPIs), show Statical Process Control(SPC) charts and Tables, a summary of all the attached reports(PDF’s, Excel Sheets, etc) that is contained in one reports been attached.

    If you Google the Access forums you’ll see how many questions without a complete answer had been ask about this topic.

    Going in to the trouble of building HTML templates, inter-op with other MS apps, etc.. I think is much easier to use your tool to take a screenshot of a report and attached to the Body of email.

    Can this be done with your tool functions? are there any issues to be aware or any other issues limitations?

    Thanks again for this a great tool!

    • TheSmileyCoder says:

      Thank you for your feedback!
      I am sure something could be worked out using bits and pieces of the code available, but I don’t have any time on hand at the moment due to a rather large house renovating project.

  7. James says:

    Thank you, thank you. This has made my tool much more professional, and made it much easier for me to fix bugs.

  8. Daniel says:

    It would be nice to make the CDO more generalized than just GMail, and thus make the Server, Port, … const variable easily editable in a config section or better yet what I do in my application is merely have this info in a table.

    Nice utility though and thank you for sharing with us all. I know how much work goes into developing such a tool firsthand!

    • TheSmileyCoder says:

      Hi Daniel
      Thank you for your comment. The truth is that I have never really worked with CDO, and thus my experience is limited. I got it to the point where I made the gmail solution work, and then didn’t really spend more time on it. Personally I have only ever been in situations where outlook was installed, and in those cases I choose to use outlook as I have more experience there.

  9. Manuel says:

    Hi there, I was hoping you might be able to advise; I’m getting a message which says “Screenshots could not be taken due to error [48].” I’m using the 64 bit version of Access on Windows 8.1.

    I changed the functions to PtrSafe and stepped into the code and found that the code errors out on the line which reads “r = OleCreatePictureIndirect(Pic, IID_IDispatch, 1, IPic)” (line 367 of the TSC_ErrRep_ScreenCapture Module).

    I was thinking it might be an issue with me not having olepro32.dll in my C:\Windows\System32, so I copied it over from C:\Windows\SysWOW64 but no such luck. Is there anything you can think of to help? Thank you for developing this tool!
    -Manuel

    • TheSmileyCoder says:

      Hi Manuel
      I don’t have experience with 64 bit, and don’t really have a way of testing it either, even if I did come up with something.

  10. Roger Alexander says:

    Hi Anders

    I have just started using the Access Crash reporter and installed a new application on one of my client’s pc.

    The return address email is a sub address on my Google account.

    The client used it to send me an email detailing an error on the application and I recieved a message from Google to say that someone (my client) has my account details and blocked the message.

    I have had to indicate that this is one of my devices and Google will continue to monitor it for two weeks.

    Is there a security problem here?

    Roger

  11. TheSmileyCoder says:

    Hi Roger
    Glad to hear it.
    As stated in the article, if you use gmail to send error reports I would recommend using a separate “dummy” account, as the application will need to contain username and password, and obviously you wouldn’t want to give out those details for your real account.
    E.g. for customer “Joes Autoshop” I might setup an email account “JoeAutoshopErrorReport@gmail.com” and use that account to send emails FROM.
    Of course if the client has outlook, it might be easier to simply use that option.

    Hope that helps to clarify.

  12. Roger Alexander says:

    Hi Anders

    Thanks for replying to my question and will take your advice to use a dummy account.

    By the way I was so wrapped up in issue I forget to mention what a brilliant piece coding this is. It has already given a much more professional feel to the application and helps me speed up the debugging process

    Congratulations and thanks for the freebee!!

Ask a question, leave some feedback, post a reply!