Chapter 13. Using Expressions in Queries and VBA Code

IN THIS CHAPTER

  • Building expressions

  • Using built-in VBA functions

  • Referencing Access objects within expressions

  • Using DLookup to look up data quickly

In this chapter, you gain a more complete understanding of expressions and functions. You have already seen and used expressions and functions in queries and forms in earlier chapters. This chapter focuses on more advanced expressions, and also discusses some of the most common built-in functions of Access. Built-in functions are very powerful in queries, forms, reports, and the VBA editor's Immediate window.

Note

This chapter uses the database named Chapter13.accdb. If you have not already copied it onto your machine from the CD, you need to do so now.

Understanding Expressions

Generally speaking, an expression is the means used to explain or model something to someone or something. An expression has a value — the expression 2 + 2 has a value of 4. Most expressions you use in Access have a value that is used by an Access application in place of a literal or simple numeric value.

In computer terms, an expression is generally composed of a combination of symbols, operators, numbers, strings, or identifiers that represent a numeric or string value. The expression is a representative object that Access uses to interpret something and, based on that interpretation, to obtain specific information. Simply put, an expression is a term or series of terms controlled by operators. Expressions are a ...

Get Access™ 2007 Bible 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.