Much of the power and flexibility of applications built using Access comes from the VBA code that you can use behind your forms and reports. Although code-less forms and reports can provide a lot of good functionality, they really shine when VBA coding techniques are added.
Access Wizards provide a first look at VBA code behind forms and reports. However, Wizard-built code is just scratching the surface. Here are some guidelines and techniques that will help you build extra functionality into your Access applications.
Me is a very special word in Access VBA. It is a reference to the form or report that your code is running in. For example, if you have some code behind the form frmBusiness, anytime you use Me in that code, you get a reference to the form object of frmBusiness.
This is a beautiful thing because there are many times that you need a reference to your own form or report, such as when you need to make it visible. You could refer to it directly, like this:
Forms!frmBusiness.Visible = True
Or, you can use the Me reference instead:
Me.Visible = True
Obviously, the Me reference is much shorter and easier to type. But there is a far greater reason to use Me: it enables you to move code from one form or report to another, where it automatically adapts to its new home.
The Me object is a full reference to a form object. Not only can you refer to it, but you can also pass it to other functions as a parameter. All you ...