Problem using a query on a column in MS access of datatype MEMO

Posted on 2001-08-10
Last Modified: 2012-08-13
I am using MS Access database for my current project. In one of the tables I have a column whose datatype is declared as memo so that I can store more than 255 characters. The data is of this type
Along with this I have another column which has repeating values.For the time being let me name it as "id", of number type.
Now I wrote a query in SQL to retrieve the distinct values from the second column namely "id".

When I use this query it will fetch only 255 characters from COLUMN1 which is of type memo and which has more than 255 characters of data in some fields.But it wroks fine if I use a query without distinct.
The same problem arises when I try using GROUP BY also.
Is it because of the buffer size limitation.Is there any other way through which I can get the whole data with using distinct in my query.

Thank you

Question by:LankaAnuradha
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
LVL 33

Expert Comment

ID: 6374952
I am not sure about this. Perhaps does your table has a primary key? Will do a research on it tonight or tomorrow. Going out now.

LVL 29

Expert Comment

by:Göran Andersson
ID: 6379699
I don't know how this works with Access, but I use disconnected recordsets in MSSQL, and that totally removes the problems with text fields (same as memo in Access). The text fields can be handled just as any other field.

Try this:

Set rstNew = CreateObject("adodb.recordset")
rstNew.CursorLocation = 3 'adUseClient
Call rstNew.Open(strSQL, cnnDb, 3, 4) 'adOpenStatic,adLockBatchOptimistic
Set rstNew.ActiveConnection=Nothing

This will create a disconnected recordset, where the sql result will be moved from the sql server into the recordset object. You can actually close the database connection and still work with the recordset. This will also give a considerable speed up in certain cases.

As the data is moved into the recordset, the text fields will loose the quirks they usually have, like that the field can only be read once.

Author Comment

ID: 6408657
This is with reference to the comment sent by Greenghost.
I tried this code as u said in my asp page.

Set rstNew = server.CreateObject("adodb.recordset")
rstNew.CursorLocation = 3
strSQL="select distinct statecode, coords from region"
rstNew.Open strSQL,ConStr,3 ,adOpenStatic,adLockBatchOptimistic
Set rstNew.ActiveConnection=Nothing

About the database
statecode is number which gets repeated in some places.and Coords is of datatype memo and has more than 255 characters of data in some of the fields.

But it gives the same error.
Here is the error.The error doesn't show up when I remove the distinct in my query.
Microsoft JET Database Engine error '80040e57'
The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data.

Is there any other way to retrive data of type memo using distinct or group by.
Thank you
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.

LVL 29

Accepted Solution

Göran Andersson earned 20 total points
ID: 6409879
For the disconnected recordset, use either
  rstNew.Open strSQL,ConStr,3,4
  rstNew.Open strSQL,ConStr,adOpenStatic,adLockBatchOptimistic

I don't think that you can use distinct on a memo field. You can't in MS SQL, at least. Not even a disconnected recordset will help here, as the error occurs inside the sql engine.

Storing comma separated strings in a database is something that I would avoid. I would store them in a separate table, if possible.

There is repeating id's but are there repeating id-column1 pairs? Otherwise distinct has no function.

Expert Comment

ID: 7018777
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101, Netminder or Mindphaser will return to finalize these if they are still open in 7 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.

*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link 
POINTS FOR EXPERTS awaiting comments are listed in the link below
Moderators will finalize this question if in @7 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
Thanks everyone.
Moderator @ Experts Exchange
LVL 33

Expert Comment

ID: 8672549
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
[points to GreenGhost]

Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

636 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