ACC: Exported Query Expression Truncated at 255 Characters

Last reviewed: January 5, 1998
Article ID: Q178743
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 export a query containing an expression that results in more than 255 characters, the expression is truncated in the exported file.

CAUSE

Microsoft Access evaluates the expression as a Text field, and Text fields have a maximum length of 255 characters. When you export the query, Microsoft Access truncates anything after the 255th character.

RESOLUTION

Use an append query to append the data to a table containing a Memo field, and then export the table. The following example creates a table to store the results of a query expression that exceeds 255 characters:

  1. Start Microsoft Access and open the sample database Northwind.mdb.

  2. Create the following table in Design view:

        Table: EmpNotes
        --------------------
        Field Name: EmpName
           Data Type: Text
        Field Name: Comments
           Data Type: Memo

  3. Save the EmpNotes table and close it. You do not need to create a
     primary key.

  4. Create the following query in Design view based on the Employees
     table. The second expression, called Comments, will result in field
     lengths greater than 255 characters:

        Query: MemoExpr
        ------------------------------------------------
        Type: Select Query

        Field: Full Name: [FirstName] & " " & [LastName]
           Table: Employees
        Field: Comments: [HireDate] & ": " & [Notes]
           Table: Employees

  5. On the Query menu, click Append Query.

  6. In the Append dialog box, type EmpNotes in the Table Name box, and
     then click OK.

  7. Select EmpName in the Append To row of the Full Name field in the QBE
     grid; the Append To row for the Comments field fills in automatically
     because the field name in the query and the field name in the table
     are the same.

  8. On the Query menu, click Run. Click Yes when prompted that you are
     about to append the rows.

  9. Close the MemoExpr query. You do not need to save it.

 10. Export the EmpNotes table to whatever format you want. The full
     length of the Comments field will be preserved.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start Microsoft Access and open the sample database Northwind.mdb.

  2. Create the following query in Design view based on the Employees table:

          Query: qryTruncate
          -----------------------------------------------
          Type: Select Query
    

          Field: Full Name: [FirstName] & " " & [LastName]
    
             Table: Employees
          Field: Comment Length: Len([Comments])
             Table: Employees
          Field: Comments: [HireDate] & ": " & [Notes]
             Table: Employees
    
    

  3. Save the qryTruncate query and close it.

  4. Select the qryTruncate query in the Database window.

  5. On the File menu, click Save As/Export.

  6. In the Save As dialog box, click "To an External File or Database," and then click OK.

  7. In the Save Query 'qryTruncate' In dialog box, select Text Files in the Save As Type box. Note the folder where the file will be stored in the Save In box, and then click Export.

  8. When the Export Text Wizard appears, click Finish.

  9. Using Notepad or another text editor, open the qryTruncate.txt file. Note that for any record where the Comment Length field is greater than 255, the Comments field is truncated at the end. This is true for the Andrew Fuller, Steven Buchanan, Michael Suyama, and Robert King records.

REFERENCES

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


Additional query words: export ISAM text excel xl fixed delimited limit cut
off cut-off
Keywords : IsmOthr IsmTxtd IsmTxtfx
Version : WINDOWS:2.0,7.0,97
Platform : WINDOWS
Hardware : x86
Issue type : kbhowto kbprb
Solution Type : kbfix


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: January 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.