Chapter 17. Automating Tasks with Visual Basic
Macros are plenty of fun, but they can do only so much. If you canât find a readymade macro action that does the job you want, you canât use a macro. No such limit applies in the world of Visual Basic code, where you can do just about anything (if you spend enough late-night hours at the computer keyboard).
Here are some examples of tasks you can accomplish with code, but not with macros:
Modify a whole batch of records at once.
Deal intelligently with errors so Access doesnât pop up a cryptic message.
Perform complex calculations. You can calculate an order confirmation code using a secret algorithm, or transform a line of text into Pig Latin.
Interact with other programs on your computer. For example, you can copy some data out of a table and into a Word document.
Write even more sophisticated validation routines that lock out bad data.
The goal of this chapter (and the next) isnât to make you a full-time code jockey. If thatâs your ambition, you can continue on to read entire books about programming Access. Instead, this chapter aims to teach you just enough to get the low-hanging fruit of Access programming. In other words, youâll pick up enough VB smarts to use the popular and practical code tricks discussed in the next chapter. Youâll also build a great foundation for future exploration.
Note
The version of Visual Basic that Access and other Office applications use is called VBA, which stands for Visual Basic for Applications ...
Get Access 2010: The Missing Manual now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.