?
Solved

Error handling

Posted on 2009-07-07
11
Medium Priority
?
302 Views
Last Modified: 2012-06-27
Im writing a procedure to handle some errors, my project has more than 70 forms, and I have to copy that procedure to On Err event of all those 70 form.
Is there any way that automate this process to avoid adding this procedure to 70 from?
0
Comment
Question by:Yadtrt
[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
  • 2
  • +2
11 Comments
 
LVL 58
ID: 24795434
Lot's of utilities out there that will do this.  One is MZ Tools and it's free:
www.mztools.com
JimD.
0
 
LVL 58
ID: 24795446
This is a better link:
http://www.mztools.com/v3/mztools3.aspx
Takes you right to the download.
JimD.
0
 
LVL 6

Author Comment

by:Yadtrt
ID: 24795452
I have MZ tool, but I dont how to use it for my situation
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 5

Expert Comment

by:DBDevl
ID: 24795719
You can put something like this in a module:

Public Sub MyErrorHandler(Err As String)
  MsgBox Err, vbCritical, "Error"
End Sub

Then call it from your error handling:

Private Sub Form_Load()
On Error GoTo HandleErr

ExitHere:
  Exit Sub
 
HandleErr:
  Call MyErrorHandler("Error# " & Err.Number & ": " & Err.Description)
  Resume ExitHere
End Sub
0
 
LVL 58
ID: 24795742
<<I have MZ tool, but I dont how to use it for my situation>>
  I could have sworn that MZ Tools had the capability to insert it into all modules, but it looks like it only works on a per procedure basis.
 I may have been getting it confused with the VBA Error handler add-in which came with the Access 2000 Office Developer Edition, which does.  But I can't find a download for that.
JimD.
0
 
LVL 6

Author Comment

by:Yadtrt
ID: 24795804
DBDevl:
I m calling the procedure, but I should call that procedure in 70 forms. I need something speed up this process instead of opening 70 froms and calling that procedure.
0
 
LVL 5

Expert Comment

by:DBDevl
ID: 24795889
Yep I understand what you are saying now.  Check out this link:

http://www.experts-exchange.com/Microsoft/Development/MS_Access/Access_Coding-Macros/Q_22438027.html
0
 
LVL 58
ID: 24795899
Sorry, but I cannot find any tool that will do an insert against an entire project or module except for the one included in the A2000 ODE.
JimD.
0
 
LVL 6

Accepted Solution

by:
Yadtrt earned 0 total points
ID: 24795971
I couldnt find what I want in that link, I dont need error handling I need to call a procedure in the On Error Event of all 70 forms
0
 
LVL 75
ID: 24796334
Yes ... MZTools will only add an error template (that you have created) per procedure.

Of course, I'm sure you could write code to programatically insert code in every procedure ... but probably not that much fun, and would still require  separate tweaking.  Here is one example of an MZTool error template I created:

    On Error GoTo {PROCEDURE_NAME}_Error

      

 



{PROCEDURE_NAME}_Exit:
       On Error Resume Next
     Err.Clear
    'Cleanup here ....
     docmd.Hourglass False
     docmd.SetWarnings True
     On Error GoTo 0
     Exit {PROCEDURE_TYPE}

{PROCEDURE_NAME}_Error:
     Call SEH_ErrProcess("Error", "Application execution error.", _
                                  "An unexpected error has occurred.", _
                                  "{MODULE_NAME}", "{PROCEDURE_NAME}", _
                                  Err.Source, Err.Number, Err.Description, Err.LastDllError, _
                                  "If the problem persists, please contact the application developer.")  
    Goto {PROCEDURE_NAME}_Exit

***

mx
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 24799578
If you're wanting error handling across the board then you may have to fork out for it depending upon your needs.
Wayne Phillips has done some great, indepth work with the Global Error Handler here.
It far extends the ability of normal error handling, for example Iterating the Call Stack and more.
Cheers.
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

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…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

765 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