O'Reilly logo

Access 2013: The Missing Manual by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 containers where you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required