[AccessD] MZ Tools

Gustav Brock gustav at cactus.dk
Thu Jan 12 01:20:44 CST 2023

Hi John

I don't use it, as I rarely write a bunch of generic code, and then I just copy-paste.
The "Review Quality" clean-up and the "Sort Code", I use, and the documentation tool which is outstanding - for example:


The single function, I use more than anything else, is the "Method Callers" option when right-clicking a function name.


-----Oprindelig meddelelse-----
Fra: AccessD <accessd-bounces+gustav=cactus.dk at databaseadvisors.com> På vegne af John Colby
Sendt: 11. januar 2023 22:23
Til: John Colby <jwcolby at gmail.com>; Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Emne: [AccessD] MZ Tools

I use MZ Tools to build a consistent error handler in any function that needs one.

Function ShowErrHandler()

    On Error GoTo ShowErrHandler_Error

    On Error GoTo 0
    Exit Function

Dim strErrMsg As String
    Select Case Err
    Case 0      'insert Errors you wish to ignore here
        Resume Next
    Case Else   'All other errors will trap
        strErrMsg = "Error " & Err.Number & " (" & Err.Description & ") in procedure TestImport.Module1.ShowErrHandler, line " & Erl & "."
#If boolELE = 1 Then
        WriteErrorLog strErrMsg
#End If
        assDebugPrint strErrMsg
        Resume Exit_ShowErrHandler
    End Select
    Resume Exit_ShowErrHandler
End Function

I would love to do a thread about how each of us uses the snippets thingie in MZ Tools.  I don't use the snippets mostly because I just never figured out how.  MZ Tools already has a handful of snippets already assigned to their toolbar and I figured out how to modify the one that builds the error code and that is what you see above.

So what snippits do you guys use?  How are snippits created?  Linked to hotkeys?  If anyone has a link to documentation on "how to" insert that in the thread.

My error handler is nothing special except that I build out a case in the error handler section.  I do specific things related to processing errors.

#If boolELE = 1 Then
        WriteErrorLog strErrMsg
#End If

Allows me to use a compiler directive to turn on or off (compile in or out) a call to an error logger.  Most probabvly do, but for those who don't...

In the editor - click tools then select the properties and a form opens which allows us to set a global (to the entire project) conditional compilation arguments.  These compiler constants  will affect all code throughout the project.


OTOH you can also do compiler constants that are only good inside the module in which it is defined.

Option Explicit
#Const DebugMode = 1

Public Sub assDebugPrint(ByVal vstrMsg As String, Optional boolPrint As Boolean = False) #If DebugPrint Then
  If boolPrint = True Then Debug.Print vstrMsg #End If End Sub

This allows me to turn on and off debug printing the errors in the debug window.

Soo.... that is all I do with snippits.  What do you do and how do you do it?
John W. Colby
Colby Consulting 

More information about the AccessD mailing list