Solved

ADODB Recordset VBA only returning 255 characters.

Posted on 2013-12-18
2
1,075 Views
Last Modified: 2013-12-18
I have two queries for ADODB recordsets on a Excel workbook.   One query works fine:

Set rs = executeQuery( _
        "SELECT [my Requirement], title, text " & _
        "FROM " & _
            "[" & strTableName & "] WHERE [my Requirement] <> '' AND [my Requirement] <> '-' AND [myRequirement] = '" & CO & "'")
 
In the "text" field I can have well over 255 (current largest data is around 1000)

However, this query truncates text at 255:

Set rs = executeQuery( _
        "SELECT Distinct [my Requirement], text, [Reference], [Justification], [Impact],[CNA] " & _
        "FROM " & _
            "[" & strTableName & "] WHERE [my Requirement] = '-' AND [my Requirement] <> '-'")

I can't figure out why one works and the other doesnt?  Any thoughts?
0
Comment
Question by:HyperBPP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Author Comment

by:HyperBPP
ID: 39727774
So turns out, if I remove DISTINCT in the second query it works allright.  Not sure why this would be.  Unless it can't compare "memo" type?
0
 
LVL 27

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 39727775
The problem with the second query is the Uniqueness, Since you asked the query to return only distinct values, Access must compare the memo field against all other records. The comparison causes truncation.

See http://allenbrowne.com/ser-63.html
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question