Code Library

Code Library

Building Your Library
Thirteen years ago, I chose to maintain a folder of text files rather than a single Access database library. I’ve never once regretted that decision.
The Dependency Train
Let’s torture a train metaphor to illustrate the dangers of dependency chaining.
Creating Optional Dependencies
Using conditional compilation to avoid the “Dependency Train” problem.
Code Library Updates
Q: How do you manage updates to code library modules?A: Version control and backward compatibility zealotry.

clsApp

VBA Alchemy: Turning Methods Into Properties
One can check the status of screen painting in Excel, but not in Access. This turns out to be an important shortcoming. Let’s remedy it.
Environmentally Friendly Access
Using the Windows Registry to manage Production, Development, and Testing environments in #VBA and #MSAccess.

clsStatus

Don’t Settle for the “Status” Quo
Wherein I wrap Access’s built-in status bar functions inside a class module for more readable code.

String Functions

Quoth thy SQL? Evermore!
Solving the “O’Malley problem” with dedicated functions to sanitize our strings. Little Bobby Tables would be proud.
Come Together
Do you build strings in loops? Stop trimming the delimiter at the end of the loop. There’s a better way.
Part and Parse()-l
Take the Tag property and OpenArgs argument to the next level. This function makes it easy to assign and extract multiple values from a single string.

Design Procedures

One Thing at a (Hundred) Times
How to use Run() and GetTickCount() for some quick and dirty performance profiling. Come for the code, stay for the scolding on premature optimization.
Listing External Table Sources
Using the Parse() function to list linked tables by source. Use this when you want to refer to Linked Table Manager info while writing code.

Form Functions

My Dirty Little Secret
I don’t use Me.Dirty = False in my #msaccess code. I wrap it up and call it from a “guard clause” instead.
Filling in the Blanks
One of the keys to being a good developer is to make the *easy way* also be the *right way*. Exhibit A: the ControlIsBlank() function.
Why so lazy, Access?
Introducing FormIsOpen() and ReportIsOpen(), two simple functions to help deal with Access’s laziness.

Image by izoca from Pixabay of the beautiful Klemintinum library in Prague. If you ever visit, remember the rules: "No talking, no running, and absolutely no defenestrating."  It's been an issue.