Link to home
Start Free TrialLog in
Avatar of Bryan Schmidt
Bryan SchmidtFlag for United States of America

asked on

Truncation of memo field in Access 2010 query

When I run a select query in Access 2010 the output for a memo field truncates at 255 characters.  I'm guessing this is normal based on various sources.  My query does not contain any aggregate functions (no group by and no expressions).  The property settings for the query are all blank so nothing appears to be suspect there.  The problem is the output results need to be exported to Excel, and since the memo column is not fully populated in the query, the result in Excel is also incomplete.

If I change my query to create a table and export or copy that to Excel, the problem does not exist.  However, for certain projects this means having to create multiple temporary tables and then deleting them.  If someone can suggest a way to modifying the query to have the full contents of the memo field appear, if possible, that would save some time and be much appreciated.
Avatar of Kelvin Sparks
Kelvin Sparks
Flag of New Zealand image

The method that you describe of using temporary tables is the accepted solution. I have not seen any other solution to this known problem.


Kelvin
you can use VBA and recordset to achieve this
Avatar of Bryan Schmidt

ASKER

If the code is not too lengthy I might try it.  My queries are simple and don't want to make them more complex than necessary.  If you can please post the code I will look at it and determine if the time it takes to make it work is less than what I'm currently doing.
when you export to excel, are you using an excel template?, existing excel file?
I don't use an Excel template or an existing file.  I create a new Excel file and then add individual worksheets for multiple exports into it (populated by pasting).
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You also need to treat this approach with caution. I have found through experience at times, Excel (not Access) will truncate data in some cells to 1024 characters. - seems to happen when a larger number of rows are being returned, or where a lot of columns are involved.


Kelvin
Rey,

The code runs and exports the Access table to Excel as expected.  The only problem is the column for the memo field essentially overwrites two columns to the right of it with data.  The column headings for the two fields to the right of the memo field appear but only the contents of the memo field appear in them in certain cases.  Those two columns contain numeric data.  Some of them are blank and, if so, the contents of the memo field populates them depending on the amount of text.  This does not happen when the length of the text string in the memo column is shorter.

The result is confusing for users and thus will not work.  I cannot post the actual results due to confidentiality but will attempt to describe how it appears in the attached file.  The third row in the attached file is the desired result but only appears when the length of the memo text string is relatively short.

If I expand the Memo column the contents still appear in the next two columns.  Expanding the two numeric columns doesn't solve the problem.  Can you suggest a way to fix this?
Memo-Column-Overflow.docx
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect!  Only change needed was to the cell reference ("b2:b100") to the one containing the memo field.

Thank you very much!
pls. don't forget to close the thread
Please note the comments from Kelvin Sparks regarding Excel (not Access) will truncate data in some cells to 1024 characters.  I have not confirmed this can occur using the code above but mention it so others are aware of it as a possibility.
Rey,

I had difficulty closing the thread until now.  I switched from using Internet Explorer 8 to Chrome and that allowed my selection of solutions, points, and grade to finally be accepted.