Results 1 to 8 of 8
  1. #1
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169

    Union query truncating a memo field

    I have a union query that is running against three different tables. Several of the fields in the tables are memo fields. When the union query executes, it is truncating the memo fields to 255 characters. I have looked at Allen Browne's advice at: http://allenbrowne.com/ser-63.html but nothing there seems to help. My code is:
    Code:
    SELECT tblCounsel1.temp, tblCounsel1.Seq, tblCounsel1.QuestID, tblCounsel1.ItemCode, tblCounsel1.Question, tblCounsel1.Response, tblCounsel1.RespOrder, tblCounsel1.ParameterText, tblCounsel1.ParameterDrug, tblCounsel1.ParameterClient, tblCounsel1.SHOW, tblCounsel1.HIDE, tblCounsel1.DrugName, tblCounsel1.RxStatus
    FROM tblCounsel1
    UNION ALL SELECT tblCounsel2.temp, tblCounsel2.Seq, tblCounsel2.QuestID, tblCounsel2.ItemCode, "" as [DUMMY FIELD 1], tblCounsel2.Response, tblCounsel2.RespOrder, "" as [DUMMY FIELD 2], "" as [DUMMY FIELD 3], "" as [DUMMY FIELD 4], tblCounsel2.SHOW, tblCounsel2.HIDE, "" as [DUMMY FIELD 7], "" as [DUMMY FIELD 8]
    FROM tblCounsel2
    UNION ALL SELECT tblCounsel3.temp, tblCounsel3.Seq, tblCounsel3.QuestID, tblCounsel3.ItemCode, "" as [DUMMY FIELD A], "" as [DUMMY FIELD B], "" as [DUMMY FIELD C], tblCounsel3.ParameterText, tblCounsel3.ParameterDrug, tblCounsel3.ParameterClient, "" as [DUMMY FIELD D], "" as [DUMMY FIELD E], "" as [DUMMY FIELD F], "" as [DUMMY FIELD G]
    FROM tblCounsel3
    ORDER BY Seq;
    Can anybody tell me why this is truncating the memo fields? Thanks!

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    jim,

    what do you mean "nothing seems to help". are you saying that you've tried all of his workaround solutions??

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I have also experienced this with UNION query. I don't think there is a fix. UNION query can't handle string values longer than 255 characters. As Allen Browne explained, this is by design.

    What is it you want to do with this UNION? Will you base a report on this data? Solution for my situation was to have a subreport for each table.

    EDIT: Keep reading if you want, apparently the fix is to use UNION ALL.
    Last edited by June7; 05-27-2011 at 02:19 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    Hi guys, thanks for responding. I have reviewed what Allen Browne has in his table and have incorporated the UNION ALL syntax and I also tried using the workaround suggested for Concatenated fields. I know this can be fixed as I had this working when the union was based of a table and a query. See the test database at: https://www.accessforums.net/queries...ters-8459.html

    Just not sure why I can't get this working on three tables with a union. Maybe something to do with the data types of all the fields not being memo? I just don't know.

  5. #5
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    Here is the original test query I had from my previous post as an fyi.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Tried UNION, UNION ALL with my data and still truncates, even when the only field retrieved is the memo field. The field name is the same in all 3 tables and so there is no alias involved. I know what you're thinking - why do I have 3 tables - I originally tried to set up with one table but aspects of this project made that not practical. Since I can view the full memo field in subforms and subreports and not necessary to be able to sort/filter the 3 tables together, UNION not really needed. I just thought it would be a quick way to build the report and that's when I learned about the truncating and determined would have to use subreports.

    I ran the query from your test project and the field truncates. Did you say this was working for you?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    Try this file....this one was working.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Yes, that one worked so made another attempt with my data. WOW, don't know what I did differently but UNION ALL on my three tables worked - no truncating and no intermediate query, directly with tables. It's a very simple query because all the fields are same and in same order in tables.
    SELECT * FROM CommentsProjects
    UNION ALL SELECT * FROM CommentsFinancial
    UNION ALL SELECT * FROM CommentsContracts;

    Lovin' it - learn something new! To make this work for my report would have to include JOINs between each of the Comments tables and respective parent tables. Maybe will play with but not critical.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query Memo Field
    By janelgirl in forum Queries
    Replies: 7
    Last Post: 04-19-2011, 09:01 AM
  2. union query needs new field
    By jmoore in forum Programming
    Replies: 0
    Last Post: 03-11-2011, 08:57 AM
  3. Replies: 2
    Last Post: 07-26-2010, 11:28 AM
  4. union query with a calculated field
    By grad2009 in forum Queries
    Replies: 9
    Last Post: 03-31-2010, 04:50 PM
  5. HELP!!! - Importing table decimal field truncating
    By Valeda in forum Import/Export Data
    Replies: 0
    Last Post: 12-05-2006, 04:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums