MZTools customization (1 Viewer)

jdraw

Super Moderator
Staff member
Local time
Today, 13:09
Joined
Jan 23, 2006
Messages
15,379
Does anyone have sample code showing usage of custom MZTools vba Loop or other code favorites?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 18:09
Joined
Jul 9, 2003
Messages
16,282
Just saw your message Jack. I'm wondering if I'm reading it right? Do you want examples in VBA of control Loops? If so, I have example on my website here:-

Loop Through a Set of Controls​


Download for Free with Coupon Code:- b27i2re

I also have some examples of looping through records sets. let me know if you want examples of those...
 

jdraw

Super Moderator
Staff member
Local time
Today, 13:09
Joined
Jan 23, 2006
Messages
15,379
Hi Tony,

No it wasn't about loops per se. I have used MZTools for many years, but only using a few pieces- indenting, error handlers and line numbering. I did use the documentation option years ago. I have heard people mention setting up code libraries and favourites in MZTools. I've searched youtube and found a reference to this in an Access related video by the Denver User Group. I was hoping to find a video or articles on how to set up and use a few other options.
If I recall correctly, you use some text files to pull in pieces of code/skeleton code that can be reused. (insert option vba). I would like to see some examples for the common Dim db, dim rs, set for example and the set rs=nothing etc when finishing a procedure.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 18:09
Joined
Jul 9, 2003
Messages
16,282
If I recall correctly, you use some text files to pull in pieces of code/skeleton code that can be reused. (insert option vba)

I don't think many people know about, or use the insert option. I Blogged about it on my website here:-

 

jdraw

Super Moderator
Staff member
Local time
Today, 13:09
Joined
Jan 23, 2006
Messages
15,379
Just bumping this thread to see if anyone is using MZTools with some customization --code library etc.,code fragments. I use line numbers, indenting code, error handler only and feel I'm barely using the potential.
Looking for some samples --nothing on youtube
 

KitaYama

Well-known member
Local time
Tomorrow, 02:09
Joined
Jan 6, 2022
Messages
1,541
@jdraw
I don't know if it's what you're looking for or not.
But it's how I do it.

First I click mztools option and navigate to code library, then I click add new item button, and add the code I want and give it a name and save it.



I added a new entry under vba (Update query with parameters)

Now when I want to reuse a code, I click Code library button in toolbar, and double click the item I want to add.
The whole double clicked code is added to vbe.

4.png


You can also add pre-defined variables or User Defined variables to your code to recall them on every new insert.
 
Last edited:

jdraw

Super Moderator
Staff member
Local time
Today, 13:09
Joined
Jan 23, 2006
Messages
15,379
KitaYama,
Thank you. That is the sort of thing I am looking for.
Do you have other tidbits that you can share?

I saw this older video and knew there was much more that MZ-Tools could do than error handler, line numbers and indenting.
 

KitaYama

Well-known member
Local time
Tomorrow, 02:09
Joined
Jan 6, 2022
Messages
1,541
@jdraw I use MZ-Tools daily as a habit and I'm not sure if I can any special way to do a task.
I'll keep an eye on what I'm doing and will post back here if I find something that may be of a use.

Meanwhile, I'll watch the video you subscribed.


PS:
User defined variables' link was not correct in my previous post.
You have to scroll to the bottom of the page and click the link for User Defined Variables.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 13:09
Joined
May 21, 2018
Messages
8,529
We can make this thread a "Post your Favorite MZTOOL Feature" thread.
This is my favorite since I create a lot of Classes.

Feature: Field To Properties
Description: Quickly and properly creates class properties
ICON:

FP.jpg


1. Create a Class variable (a private variable in a class at the module level)
Example
Code:
Option Compare Database
Option Explicit

Private WithEvents m_Listbox As Access.ListBox
Private m_NumberRecordsInColumn As Long
Private m_NumberOfColumns As Long
Private m_FirstRecord As Long
Private m_Domain As String
Private m_DisplayField As String
....
2. Select Field to Property and it renames the Class variable and creates the proper Get, Let / Set properties
Field to Property.jpg

In this case I simply type
Code:
Private Dog as string
put the cursor before
Private Dog as String
Select Field to Property (upper left icon FP) and it creates the Get and Let and renames the local variable to m_Dog. Some other features as you can see to make it real easy to create proper properties quickly.
 

Attachments

  • FP.jpg
    FP.jpg
    870 bytes · Views: 33
Last edited:

jdraw

Super Moderator
Staff member
Local time
Today, 13:09
Joined
Jan 23, 2006
Messages
15,379
MajP, (y)
Such a thread could be very useful for any/all using MZ-Tools. Samples of favourite code fragments and most useful features could be a great reference and teaching/learning facility.
 

moke123

AWF VIP
Local time
Today, 13:09
Joined
Jan 11, 2013
Messages
3,920
My favorite is the same as @MajP 's. I like the Compact setting which formats lines like
Code:
Public Property Get lstMatches() As Access.ListBox: Set lstMatches = m_objlstMatches: End Property
Public Property Set lstMatches(ByVal objNewValue As Access.ListBox): Set m_objlstMatches = objNewValue: End Property

Looking through MZ-Tools now, I never realized there was so much there I never looked at.
 

KitaYama

Well-known member
Local time
Tomorrow, 02:09
Joined
Jan 6, 2022
Messages
1,541
I also use Code Explorer extensively. I hate to select a control from the left combo and then select one of its events from the right combo.
Code Explorer shows all events, functions & properties of the current form, module or class.
It's opened and docked to the right side of the editor and I can simply double click one of them to work on it.

55.png
 

moke123

AWF VIP
Local time
Today, 13:09
Joined
Jan 11, 2013
Messages
3,920
:(
This is getting a little depressing considering all the time I put into "rolling my own" I have a form I keep in Application parts which I import into every project. One part generates various code depending on the selected table and fields and another lists and navigates through all the Modules and procedures.

I guess the upside is I learned a lot about Vba Extensibility. I'm gonna spend some time seeing what else I missed with MZ-Tools and start stripping it out of my form.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:09
Joined
Feb 19, 2002
Messages
43,275
The code explorer looks very useful. I've never tried it.

Regarding using the code snippets. While I love the concept and bought into it whole hog a long time ago, I don't use it now and won't but I wish I could. The problem is that I don't know where the data I enter is stored and I don't have a way of backing it up. After using MZTools for a few years, my hard drive crashed and while I could reinstall the software, all my customization was lost. I would be much happier with the product if it stored my customizations in an Access .accdb so I could at least recover it after a HD meltdown.

So, I keep my own database of useful code. In some cases, it even has tokens I can replace after importing the procedure.
 

KitaYama

Well-known member
Local time
Tomorrow, 02:09
Joined
Jan 6, 2022
Messages
1,541
@moke123
Just don't forget to backup MZ-Tools settings every now and then.
If something goes wrong with your PC and you're forced to do a refresh or a reinstall, everything's gone.
Some part of MZ-Tools (for example code library) need a separate export to back up what you have.
 

KitaYama

Well-known member
Local time
Tomorrow, 02:09
Joined
Jan 6, 2022
Messages
1,541
he problem is that I don't know where the data I enter is stored and I don't have a way of backing it up.
Where you add your snippets, you have a text box at the bottom that tells you where it's been saved. You can even brawse and change it to any folder you choose.
 

moke123

AWF VIP
Local time
Today, 13:09
Joined
Jan 11, 2013
Messages
3,920
@moke123
Just don't forget to backup MZ-Tools settings every now and then.
If something goes wrong with your PC and you're forced to do a refresh or a reinstall, everything's gone.
Some part of MZ-Tools (for example code library) need a separate export to back up what you have.

I do. I move code library items between home and office.

This quality review looks interesting, especially the Dead Code Review.

deadcode.png
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 13:09
Joined
May 21, 2018
Messages
8,529
Second favorite feature is the Procedure Sorter. Once I write a form, report, custom class or other module I like to use the manual sort to put everything in a logical order

Feature: Sort Code Elements
Description: Allows you to automatically or manually order procedures
ICON:
SorterIcon.jpg


Sorter.jpg

In the above custom class example, I put the initialize method first, then the private/public procedures, then all the movement procedures, then all the class property procedures.
 

KitaYama

Well-known member
Local time
Tomorrow, 02:09
Joined
Jan 6, 2022
Messages
1,541
I don't use this feature frequently, but every now and then I see a help request post here, someone's trying to find the count of modules. codes, etc.
Some experts offer vba codes, but MZ-Tools has a nice review feature.

One click on Review button, and you'll have this. (There are more column to the right )

15.png
 

Users who are viewing this thread

Top Bottom