Visual Foxpro access retrieve data memo fields

Posted on 2011-09-15
Last Modified: 2012-05-12
Normally I never use in my applications memo fields. Always had some issues to use them, namely because it was not clear to me the way i should write and read data in these containers.
I would like to know the way I should write and retireve data from Visual Foxpro memo fields
and what kind of data I can insert into them.
Thanks in advance for you help
Question by:luciliacoelho
LVL 27

Accepted Solution

CaptainCyril earned 250 total points
Comment Utility
I use memo fields to write lengthy values (more than 254 chars).
I also use memo fields to store Unicode text, RTF text and properties (ini files).
I used to store word documents, pictures, MS-Charts in memo fields only to display them in FRX Reports but now I store them outside the table and reference them from inside the table and the filenames are store in the memo fields.

To normally use memo fields
REPLACE table.memofield WITH cLongText
Thisform.editbox.Value = table.memofield

To store an object instance in a memo field use APPEND MEMO
APPEND MEMO notes FROM test.txt

To store General Fields: Pictures, Music Files, Charts, ...
CREATE TABLE MyGenTbl (mygenfield G)
APPEND BLANK  && Add a blank record

If you are using some DBF readers or database connections, you might have problems reading and writing from memo fields.

If you use COPY TO sheet.xls TYPE XLS it will not export memo contents. You will have to do that via Excel Automation.
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 250 total points
Comment Utility
A normal memo is like a larger textfield, so you read and write to it like to a normal char field.
Cyril already discussed some other commands special to memos, but you don't need APPEND MEMO, it's just another possibility. You could also read in a file via FILETOSTR() and then store that as you store a value coming elsewehere into a char field. From that perspective it's as easy to use and maintain as any char field.

The difference is in how VFP displays memo contents. Simply use an editbox instead of any other control, and you get the memo content directly displayed instead of "memo" or "Memo", which is what foxpro displays in a textbox or a default grid column.

Another difference Cyril already told is the handling of memos in COPY TO and also EXPORT.

And yet another difference is, you can't GROUP BY memo fields in SQL, and you can't also SELECT DISTINCT with a memo field in the field list. I can only guess the machnisms doing these kind of sql operations need same size values and VFP would need to pad all memos to the same maximum length for that, which was considered as a bad thing performancee wise, so instead this was handled as forbidden, there may also be a size limit as the one for normal char fields.

There are some special memo field types, if talking about memo as a term for all field types stored in an fpt file, namely blob and general field. I'd avoid general in general, and blob is for storage of files, a special feature is you can set an image control pictureVal property to a blob field and let it display as picture, valid for images stored in blob, that foxpro can display, but it's easier and better to not put files into tables anyway.

Additional to that there is memo (binary), but that is also a form of field modification you have for other field types, eg char (binary). This simply means storage is not for a certain codepage and putting in values does neither check any codepage nor make any conversion, data is stored 1:1

Memo is convenient for larger portions of text, especially multi line. I mainly use it for comment/remark fields with less important data, that nevertheless will perhaps help to store some instructions of other short text passages.
I also sometimes use it for paths, as those can get longer than 254 chars. But I mainly use it for larger texts, not even for rtf, which is not wrong, but plain text without more formatting attributes is okay for my user base.

Bye, Olaf.

Author Comment

Comment Utility
Thank you Olaf and Ciryl for your information. i'm going to try your  helpful advises

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: (http://msd…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now