Microsoft Office 2000/Visual Basic Programmer's Guide |
You can build add-ins for Access to help users manage and analyze their databases. Access includes several add-ins, which are written in VBA. For example, the Linked Table Manager is an add-in that handles the updating of linked tables when the database containing the source tables is moved or renamed. The wizards included with Access are also add-ins.
Access add-ins have the file extension .mda or .mde. A user can open an .mda file and look at the code, unless you've secured the modules by using either user-level security or project-level security. When you create an .mde file, however, all VBA source code is removed. The .mde contains only compiled VBA pseudocode, which can't be viewed by the user. Creating an .mde file is therefore the best way to secure your code, if you're concerned about protecting your source code. For more information about .mda and .mde files, search the Microsoft Access Help index for "MDE files." For more information about securing Access database applications, see Chapter 18, "Securing Access Databases."
When you write code that will run in an Access add-in, use caution when referring to the current database. If you want to refer to the add-in database in which code is currently running, use the CodeProject or CodeData object to return a reference to this database. If you want to refer to the database that's currently open in Access, use the CurrentProject or CurrentData object.