Improve company productivity with a Business Account.Sign Up


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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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.

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…
In the video, one can understand the process of resizing images in single or bulk. Kernel Bulk Image Resizer is an easy to use tool for resizing large number of images. One can add and resize multiple images with this tool in single go. The video sh…

606 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