Read memo field from database ( MS-Access)

ceus's Avatar, Join Date: Oct 2006
Go4Expert Member
Hi friends,
I have a problem, i am using CRecordSet class member function GetFieldValue() to read a field from database ( MS-Access ) but when the type of the field is of type "Text" i am able to read properly, but when i change the field type to "Memo" i am not able to read it, it is giving and exception and even the exception is BLANK..
can someone tell me a way to read a Memo field from MS-Access database using CRecordSet class or by any other way...
apr pillai's Avatar, Join Date: Dec 2010
Go4Expert Member
The sample VBA Code below reads and prints (in the Debug window) the contents of a Memo Field (Notes) from the Employees Table of MS-Access sample database - Northwind.mdb:

Public Function memotest()
Dim db As Database, rst As Recordset, xyz As Variant
Set db = CurrentDb
Set rst = db.OpenRecordset("Employees", dbOpenTable)
Do While Not rst.EOF
   xyz = rst![Notes]
   Debug.Print xyz
Set rst = Nothing
Set db = Nothing

End Function
The memo field value is read into a Variant Type variable (xyz) before it is being printed on Debug Window.
shabbir like this