Solved

Table holding error log -

Posted on 2011-03-18
8
288 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
Technology Partners: 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 57

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

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error 438 6 46
Email question 19 83
Form performance table vs. query 27 61
access vba 5 51
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

740 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