Chapter 18. Writing Smarter Code
In Chapter 17, you dove headfirst into the world of Visual Basic code, writing routines that could show messages, respond to events, and modify forms. Along the way, you learned a fair bit about the Visual Basic language and the object-based system that gives VB its mojo.
Thereâs still more to explore. In this chapter, youâll learn how to use VB code to solve some of the most common problems Access experts face. Youâll focus on improving the Boutique Fudge database, which youâve worked with throughout this book. However, the solutions youâll use are so useful that youâll want to incorporate them into your own databases.
But first, before you tackle these more advanced examples, youâll start by brushing up on the Visual Basic language, learning how to defang errors, and taking a closer look at objects. These topics complete the Visual Basic picture and prepare you to become a true Access programmer.
Exploring the VB Language
Although you now know enough to react to events and change control properties, thereâs still a lot to learn about the Visual Basic language itself. In the following sections, youâll learn how to use variables, conditional logic, and loops to write more powerful code. Finally, youâll see how to use these features to build a more complex code routine that checks for invalid credit card numbers.
Storing Information in Variables
Every programming language includes the concept of variables, which are temporary storage ...
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.