Solved

Table holding error log -

Posted on 2011-03-18
8
289 Views
Last Modified: 2012-05-11
Hi,
(This is probably a bit lazy but...)

I have a table that is log of all errors that occur.
A fundamental part of this simple log is ;

AuditDetails = AuditDetails & "Form : " & Screen.ActiveForm.Name & "     User: " & Environ("Username")

I do NOT pass any actual data to the Audit function.
You will note that the "ActiveForm" is referred to.

Question: Is there any other info such as "ActiveForm" that I could refer to.?  For example, I was wondering could I some how refer to some "primary index" of a table??

I am hoping that I can add some additional helpful info to the error message without actually passing any to it!     (I already know the user, the time and the form ...)
0
Comment
Question by:Patrick O'Dea
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 75
ID: 35168727
Well sure:

Err.Number
Err.Description


ERL  ... which is the error Line Number ... and you can use the free MZTools to easily add line numbers to your code:

http://www.mztools.com/v3/mztools3.aspx

This is just for starters ...

Not sure why you would need the Primary Index ... which in general would have nothing to do with any error per se ...?

mx
0
 

Author Comment

by:Patrick O'Dea
ID: 35168790
Thanks databaseMX,

... I appreciate your interest.

Example:  A user is keying contact information into a customer record ... suddenly an error occurs.....It would be very nice to know the unique  customerID.

E..g Customer C0001 was being processed when the error occurred.
0
 
LVL 75
ID: 35168807
I see.  But that would not necessarily apply to every place/instance an unexpected error might occur.  Sure ... on a specific Form maybe, but not elsewhere.

mx
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:Patrick O'Dea
ID: 35168871
Yes, I know mx,

The nature of my query may mean that there is no real answer.

However, I just wanted to make sure I did not miss anything.

(I will use err.number & description)
ActiveForm is of a great help but I guess that that may be the only such one.

I guess that is it???

(... currently browsing MZtools..)
0
 
LVL 58

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 100 total points
ID: 35171341
<<Question: Is there any other info such as "ActiveForm" that I could refer to.?  For example, I was wondering could I some how refer to some "primary index" of a table??>>

  I think if you do as Mx suggested (adding the line number), you'll find that you can pin-point errors quickly.  To add to that I also do this:

Const ModuleName = "OCS_AppUtilityFunctions"

at the top of each module and add:

        Const RoutineName = "SetCurrentCompany"
        Const Version = "1.1.0"

 to the top of each procedure.  The call then to my error handler is:

ErrorHandler:
130     UnexpectedError ModuleName, RoutineName, Version, Err.Number, Err.Description, Err.Source, VBA.Erl
140     Resume Exit_Sub

  Which pin-points things very well.

  Also, you might be interested in this:

http://www.everythingaccess.com/vbwatchdog.htm

  which is a global error handler for VBA.

JimD.
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 400 total points
ID: 35172565
"(adding the line number), "

When I discovered mzTools a few years back, I started adding the Line Numbers.  This has made a *huge* difference in tracking down errors, an subsequently fixing the issue ... especially in functions with a LOT of code.  Just knowing the function name - not that helpful per se.  I once made a $100 donation to MZTools.

And (as noted) ... although a bit more advanced, I *highly* recommend Wayne's vbWatchdog for the ultimate error handling functionality, which I have been slowly integrating into my apps.

http://www.everythingaccess.com/vbwatchdog.htm (read my review).  However ... good to start with basic error handling as you are doing - to get the background.

" To add to that I also do this:"
Actually ... MZTools can add that automatically for you - by creating a custom error handling template and using the 'replacement variables' - see image - eg {PROCUDURE_NAME} .  Same goes for Procedure Headers, Module Headers, etc.  Soooooo many cool features.

RE:"I guess that is it??? "
Well, there is also Screen.ActiveControl ... but again, that only applies to certain cases.

mx
Capture1.gif
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 35172809
Thanks againmx,

I have downloaded MZ and this could be a new adventure. My knowledge of Access is incrementing by about 20% per month at the moment ... mainly thanks to EE.
0
 
LVL 75
ID: 35172821
You are welcome.

"about 20% per month at the moment"
MZTools will put you on Access steroids !

Thanks for using Experts Exchange ...

mx
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question