Grouping by Memo field yields garbage

        1 votes: *****     1,117 views      No comments
by Allen Browne, 01 December 2006    (for Access 97+)

Flaws in Microsoft Access

Provided by Allen Browne, July 2007, based on a posting by Peter Miller.

Grouping by Memo field yields garbage

This article describes a bug in Access 2000 and later (JET 4 and later), where a memo field is displays incorrect characters under these conditions:

  • You GROUP BY a memo field.
  • Your query contains a JOIN on an unindexed field.

The display is typically one or two strange characters, instead of the contents of the memo field.

You can download the demonstration database shown below (10kb, zipped, Access 2000 format mdb.)


TableOne consists of two fields:

  • FieldA is a Number (Long Integer), with 3 records (the numbers 1, 2, and 3.)
  • FieldB  is the Memo field, with the text "one", "two", and "three."

TableTwo has one Number field (Long Integer), with 3 records (the numbers 1, 2, and 3.) There are no indexes in either table.

The query joins the two tables, and groups by the fields in TableOne. The inset shows how JET displays the output of FieldB incorrectly.

Screenshot of query design and output


Either of the following will work around the bug:

  • Do not group by the Memo field. Instead choose First in the Total row under the memo field. This not only avoids the bug, and is much more efficient to execute, but it also allows JET to return the entire memo field instead of truncating it at 255 characters.
  • Index the fields involved in the JOIN.

Other bugs

There is a similar bug where concatenated text fields yield garbage, but applies to recordsets only.

See truncation of memo fields for details of of how to avoid chopping off the contents at 255 characters.

Home Index of tips Top

Rate this article:  Your rating: PoorYour rating: Not so goodYour rating: AverageYour rating: GoodYour rating: Excellent

This is a cached tutorial, reproduced with permission.

Have your say - comment on this article.

What did you think of 'Grouping by Memo field yields garbage'?

No comments yet.

Why not be the first to comment on this article?!

Have your say...

E-mail (e-mail address will be kept private)

Comments require approval before being displayed on this page (allow 24 hours).