Chapter 13: Accessing Data with VBA Code
479
FIGURE 13.3
Setting the Unique Values property
Unique Values property
Top Values property
Unique Records property
Records returned by a query that includes the DISTINCT predicate are not updateable. Each
record in the result set represents one or more records in the underlying tables, and there is no
way for Access to know which records to update. Therefore, the data returned by a DISTINCT
query is read-only.
DISTINCTROW
The DISTINCTROW predicate is unique to Access. It works much like DISTINCT, with one big
difference: It looks for duplicates on the basis of all fields in the table(s) underlying the query, not
just the fields selected by the query.
Generally speaking, Access queries behave as if DISTINCTROW were always included in the SQL
statement. The only time you’ll see a query with DISTINCTROW return different records than a
query without DISTINCTROW is when all the tables underlying the query contain exactly the same
records. Because all the tables in a normalized database include a primary key that uniquely identi-
fies each row, it’s unlikely that a DISTINCTROW query will find identical records in tables joined
by a query.