Chapter 7. Expressions, Macros, Code Modules, and Custom Controls

Using Access without writing your own expressions is like never going beyond paint-by-numbers. Expressions—little snippets of variables and commands—let you customize the way Access works. Working with expressions in Access can be maddening, though, because documentation is often missing, and Access’s error messages can be completely unhelpful. We start this chapter by supplying fixes for a variety of expression annoyances, including syntax issues, blank expressions, and common errors. The first section also examines how to work with quoted values, dates, and more.

Then we move on to Visual Basic, a full-blown programming language—this is expressions on steroids! Many Access users hesitate to use Visual Basic because it seems too hard, but the irony is that Access development becomes much easier once you can write a little code. Many of Access’s pitfalls and quirks can be sidestepped with a line or two of VB code. We’ll show you how to find your way around in Visual Basic (despite the gaps in documentation) and take advantage of the VB Editor, which is actually a pretty nice tool. We’ll focus on some of the most common tasks, such as displaying a file chooser dialog box and sending an email from a form. To get a leg up on Access and VB, check out Access Database Design & Programming, Third Edition (O’Reilly), Access Cookbook, Second Edition (O’Reilly), and Microsoft Access 2002 Visual Basic for Applications Step by ...

Get Fixing Access Annoyances now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.