Go Premium for a chance to win a PS4. Enter to Win


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

Posted on 2001-08-10
Medium Priority
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
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 29

Accepted Solution

Göran Andersson earned 80 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.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

782 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