Book Review: Access 2002 VBA Step By Step

Buy this book

I want to explain how I came to be in possession of this
book. Though I’ve been programming with MS Access for over 7 years, I only
just recently joined my local Microsoft Access User Group
.  I finally rearranged my life so I could attend meetings and joined
the group. The evening of my first meeting, my first visit to the group, I
won a door prize: The Microsoft Press book, Access 2002 Visual
Basic for Applications Step By Step
by Evan Callahan.



Being a step-by-step book I assumed that most of its
contents would be familiar to me, but I never turn down a book. I am always
looking for that tip or trick I have never heard of that will save me hours
of development time in the long run. Even if I find nothing genuinely
"new" it is always nice to be reminded of the many and various
features of Microsoft Access. So, on with the review.

  • What’s in the book?

  • How’s it written?

  • Tips and tricks found

  • Is it worth the $39.99?

What’s in the book?

The author, Evan Callahan, begins by explaining how to use
wizards to create a database, form and command button. If you need
instruction on how to accomplish these tasks, you probably would not be
buying a book with the words "Visual Basic for Applications" in the
title. All the same, the chapter was not offensive and by the second chapter,
we are already writing custom code.

In the author’s defense, I should point out that the button click code
generated by the wizard is used to explain and describe the anatomy of a
procedure. This assumes, of course, that we consider the Microsoft Access
wizard coding style to be the best template from which to learn programming.
While that is, to a large degree, how I taught myself coding, I cannot say
with a certainty that it is the best way.

The book’s 15 chapters include instruction on the following topics:

  • Filtering and validating data

  • Understanding and reacting to form and control events

  • Writing your own functions with error handling

  • Navigating through your application

  • Custom menus, toolbars and finishing touches

  • Exploring Access objects and collections

  • Report tricks in VBA code

  • Automating Word, Excel and Outlook from within MS Access

  • Web topics (of course … it’s mandatory)

How’s it written?

In my opinion, the book is well written and it reads with
little discomfort. Technical books have a tendency to get tiresome at times,
but the author mixes up a good variety of explanatory text, code snippets and
screen shots. Regularly placed "Tips" sections contain useful
information and are not overdone.

Callahan’s code examples are praiseworthy and they are included in the CD
that comes with the book. The reader is walked through topics while creating
a Newsletter Subscription Database Application, which, while simple,
represents a real world business solution.

I typically read technical books with a red pen and a yellow highlighter. I
use a red pen so that points I mark stand out when I am revisiting the book,
months (or sometimes years) later. Flipping through the book as I prepared
this article I noticed numerous paragraphs flagged with red ink, some even
got the highly coveted "good tip" comment. Not that these points
are earth-shattering revelations, mind you. They are, however, good, solid
tips without which the book would be incomplete.
 

Tips and tricks found

What would a review be
without a little preview of what you can expect? Following is a brief list of
some of the ‘Tips and Tricks’ I uncovered.

1. Turn
off the animated Office Assistant
You’ll get more flexibility accessing the Help topics
using the Contents and Answer Wizard tabs in
the Help Window.  (Better yet, find an old copy of the help file for
Access. It is better than either one!)
 

2. Try
out the Immediate Window  (Ctl + G)
This is the best tip in the book, and one I highly recommend!
From the Immediate window, you can do ANYTHING and EVERYTHING that you can do
in code. Want to run a function?  Type it in and hit ENTER, and it will
run.  Type a question mark (or the word PRINT) and the function will
return its value.  For example, type ?Date() or ?Now() and it will print

the current date or date-time value. Type Len("My Name Is Danny")
in the Immediate window, and it will return the number 16.  You can even
access Form controls.  For example, to set the row source for a list
box, you could type this line into the Immediate Window and change the
property:


Forms!frmMain.lstOut.RowSource = "SELECT * FROM tblIssue Where State=’CO’"

3. Tip: 
While you can include a space in a button caption, its underlying control
name should NEVER
include a space.
The text on the button can read Add 
Record
 but its name should be AddRecord,
or better yet, cmdAddRecord.  (I know this seems
simple, but it will save you hours and hours of development time.)
 

4. Get the most out of Intellisense: 
When you type a dot after an object, such as the DoCmd
object, or even one of your controls,such as cmdAddRecord mentioned above, Intellisense
kicks in and gives you a list of options from which to choose.  You can
select one by using the up and down arrows to navigate up and down the list,
or by typing the first few letters of the property or method.  You
probably knew that, but did you know that you can select it by tapping the
Spacebar?  Did you know that if the Intellisense list does not pop up
(or disappears) you can open the option list by holding down the control
key and pressing the spacebar (Ctl + spacebar)?  That’s a tip worth
knowing.
 

5.
Procedure and Function naming and best practices.
The book twice mentions best practices on how to
name procedures and functions, as well as
suggestions on how to effectively delegate tasks within functions to make
them flexible and
reusable.  If you aren’t already using these techniques in your code,
you should read this.
 

Is it worth the $39.99?

That’s a difficult question for me to answer. Remember, I
won this book as a door prize. Over the last eight years I’d say I’ve read
about 80% of all the Access books on the market  With that much devotion
to all things Access, I’m usually surprised when I stumble on
genuinely new information, and I found nothing new in this book.

If, however, you are relatively new to Access and want a good start on
becoming a power user, it is not a bad place to start. At just under $40 it’s
not the most expensive book on the bookstore shelf and its code examples and
best practice suggestions are likely to save you more than a couple of hours
of development time, which means this book might pay for itself.
 

Buy this book

»


See All Articles by Columnist
Danny J. Lesandrini

Danny Lesandrini
Danny Lesandrini
Danny J. Lesandrini currently works as the IT Director for Pharmatech Oncology Inc. at http://www.pharmatechoncology.com/. He holds Microsoft Certifications in Access, Visual Basic and SQL Server and has been programming with Microsoft development tools since 1995.

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles