?
Solved

Table holding error log -

Posted on 2011-03-18
8
Medium Priority
?
290 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 400 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 1600 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Suggested Courses

800 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