ACC: Error Using OLE or Memo Field in Union Query

Last reviewed: May 7, 1997
Article ID: Q120908
The information in this article applies to:
  • Microsoft Access versions 2.0, 7.0, 97

SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

When you run a SQL-specific union query that contains an OLE Object field, you may receive the following error message:

   Can't use Memo or OLE object field <fieldname> in the SELECT clause of
   a union query.

CAUSE

By default, union queries implicitly sort the data and delete duplicate records. Because Memo and OLE Object fields cannot be sorted, the error occurs.

RESOLUTION

To avoid this error, add the ALL predicate to eliminate the sorting of the field data. For example, add the ALL predicate to the following SQL statement

   SELECT DISTINCTROW Employees.[LastName], Employees.Photo
   FROM Employees
   UNION
   SELECT DISTINCTROW Employees.[LastName], Employees.Photo
   FROM Employees;

to produce the statement:

   SELECT DISTINCTROW Employees.[LastName], Employees.Photo
   FROM Employees;
   UNION ALL
   SELECT DISTINCTROW Employees.[LastName], Employees.Photo
   FROM Employees;

Note that the SQL statement with the ALL predicate does not remove duplicate records.

NOTE: The [LastName] field in the above example should be [Last Name] in version 2.0.

REFERENCES

For more information about union queries, search the Help Index for "union queries," or ask the Microsoft Access 97 Office Assistant.


Additional query words: querying
Keywords : kberrmsg kbusage QryUnion
Version : 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 7, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.