Microsoft Access VBA Macro Programming

(Tina Sui) #1

Saving Your Code.


Knowing how to save your code along with the workbook file you are using is important. The
process is quite simple in that you either click the disk symbol on the VBE toolbar or click
File | Save... on the menu bar in the VBE window.
Following this procedure will save all the changes in the modules, including any forms
and reports you have. You should regularly save code as you develop it. Otherwise, if a power
failure or other crisis occurs, you may lose your work.
When making important changes to code, it is often useful to create another version of the
file with a different version number, such as 1.02 or 1.1. If there is anything untoward found
in the code or the database, you then have a fallback position where you can go back to an
earlier version of the database and start again.
If you have used Excel to develop VBA applications, it is very easy to save another copy
of the spreadsheet as a different name. Access does not offer this flexibility. Once you have
created a new database, you can only use the Save As function to save to another format,
something you do not want to do for another version.
The solution is to close down the database and make a copy of it in Windows Explorer
(right-click the Windows Start button in the bottom left-hand corner of the screen). You can
then give this file a new version number in the name and load that to work on it.
When working on an Access database I always use this technique for development,
particularly if the application is live. Far too much can go wrong even when using simple
VBA code, so you should always have a fallback position.

12 Microsoft Access 2010 VBA Macro Programming

Free download pdf