Wednesday, December 2, 2009

How to Be a Self Taught Access Database Programmer

So you don't plan on making programming a career, but for some reason (need, fun) you want to make your database really sizzle. Maybe your database is your pet project, a guilty pleasure during downtime. Or you hope it will increase your value to your company (and often it can). But the most you've ever done that closely relates to programming is hitting the "Record" button in Excel to record a macro. Let's talk about ways you can learn to do some basic Access programming without taking a hammer to your PC after a few hours.

1) Very Small Bites
Programming can be as challenging as learning a foreign language, and then some. Set some very, very simple goals. Like, "I'm going to make a message box popup that says 'Hello World'." There is good reason why most books you pick up about programming make this the first step. The proverbial "Hello World" is a small, achievable milestone that you can check off as a success. You'll want to have lots of these to keep you going, to offset the frustration when you just can't understand why something doesn't work.

2) Learning by Example
Microsoft Access has been around for over 15 years now. The wealth of examples, samples, and Access templates available on the internet is astonishing. Familiarize yourself with what is out there, and then pick apart a template or example you like. Find out how it ticks, and adopt the useful material for yourself. Unlike writing a college paper, code samples publicly available on the Internet are generally there to be copied. Respect any copyright notices that you may need to include in your code, but otherwise, take it easy on yourself. Don't recreate the wheel when there are so many samples and tips available. Click for a collection of Access tips and resources.

3) Engage the Experts
After you've spent time learning the basics, and you've hit a wall, you'll find an amazing group of people willing to help. The message boards are full of experts always willing to help out. A few tips to have a good experience:
a) Always do a search on Google, and search the posts, for any solutions to your problem. The experts are patient, but I've noticed they get (understandably) touchy when a well-known solution to a common problem is brought up by a new user. They prefer to help those that have tried to help themselves (as opposed to posting questions without doing any work to find a solution first).
b) Explain the problem thoroughly. Something like "I'm getting an error in my code when the user clicks a button" is about as helpful as when someone in elementary math would raise their hand to say "I ended up with 9.5 on this problem." The teacher hasn't seen the work, and so has no idea where the problem may have occurred. Similarly with programming, give as much information as possible. For example: "I'm encountering error 999 'Object Does Not Exist' when I tried to open a recordset."

4) Celebrate Successes
An extension of #1 above, make sure you allow yourself little "wins." If you've got a complex set of steps you're trying to accomplish, break them into little pieces that you can check off. If you get very frustrated, sleep on it.

5) It doesn't have to be pretty
If you are learning to program, your first many attempts won't be pretty. And unless you plan to sell your solution, or you are really looking forward to a career in software programming, don't worry about how pretty the code looks. It needs to work, of course. But it needs to work for your purpose. You'll find a lot of purists that may chuckle if you don't use (or know about) class modules instead of normal modules. You may know that your monolithic, 500 line subroutine isn't the optimal way to handle something, but what matters is that it works reliably. If you have time later, you can rework it to remove redundant code, move some parts to separate functions, etc.

6) Enjoy!
Learning to program is like anything else that comes with satisfaction, it is earned through a good deal of challenge and frustration. But in the end, you have tangible (your application) and intangible (the new knowledge you possess) accomplishments you can admire.