Microsoft KB Archive/90106

{|
 * width="100%"|

PRA: &quot;Expression Is Too Long for the QBE Grid&quot; Error Message
'Article ID: Q90106

Creation Date: 08-OCT-1992

Revision Date: 19-SEP-1996' The information in this article applies to:


 * Microsoft Access versions 1.0, 1.1, 2.0

SYMPTOMS

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

You receive either of the following error messages:

Expression is too long for the QBE grid

-or-

Expression is too long for the QBE grid and has been truncated: '' CAUSE

In order to avoid repetitive columns, Microsoft Access combines Criteria columns in the Query by Example (QBE) grid if two or more columns in the grid have the same field name. You will see this behavior after you save the query and then open it again.

This behavior only causes a problem when you are trying to use a long WHERE clause. In Microsoft Access version 2.0, each cell of the QBE grid is limited to 1024 characters. If your expression is longer than this, you will receive the error message:

Expression is too long for the QBE grid In Microsoft Access version 1.x, each cell of the query grid is limited to 255 characters. If your expression is longer than this, you will receive the error message: Expression is too long for the QBE grid and has been truncated: '' This error can also occur if you type too long a WHERE clause in the SQL View window and then switch back to Design view. RESOLUTION

There are two workarounds for this behavior. The first is to break the larger statement into two smaller statements. The other method is to use SQL view only, avoiding displaying the query in Design view. This method is only available in Microsoft Access version 2.0.

To break a long statement into two smaller statements, choose either of the two columns with the same field name and put parentheses around the field name. The following example demonstrates this method:

  Create the following sample query: Query1 --     Field Name: UserID Criteria: Like &quot;DAV*&quot; Field Name: UserID Criteria: Like &quot;DAVOLIO*&quot;  Save and then close the query.  Open the query in Design view. Note that the query is now: Query1 --     Field Name: UserID Criteria: Like &quot;DON*&quot; And Like &quot;DONFU*&quot; Field Name: UserID  Re-create the query you created in Step 1.  Place parentheses around the second field name as follows: Query1 --     Field Name: UserID Criteria: Like &quot;DON*&quot; Field Name: (UserID) Criteria: Like &quot;DONFU*&quot; NOTE: If the field name is more than one word, place brackets around the field name before putting the field name in parentheses.  Save and then close the query.  Open the query in Design view. Note that the query is now: Query1 Field Name: UserID Criteria: Like &quot;DON*&quot; Field Name: Expr1: ([UserID]) Criteria: Like &quot;DONFU*&quot; </li></ol>

Putting parentheses around the field name turns the field into an expression. This differentiates the column from the other column with the same field name and prevents Microsoft Access from combining the columns. STATUS

Microsoft has confirmed this to be a problem in Microsoft Access versions 1.x and 2.0. This problem no longer occurs in Microsoft Access for Windows 95 version 7.0.

REFERENCES

Microsoft Access &quot;User's Guide,&quot; version 1.0, Chapter 5, &quot;Query Basics&quot;

Microsoft Access &quot;User's Guide,&quot; version 2.0, Chapter 10, &quot;Query Basics,&quot; and Chapter 11, &quot;Designing Select Queries&quot;
 * }

-

"THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED &quot;AS IS&quot; 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." '' ©1997 Microsoft Corporation. All rights reserved. Legal Notices.

''

Additional reference words: 1.00 1.10 2.00

KBCategory: kbusage kberrmsg

KBSubcategory: QryOthr