Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MS Access (http://www.go4expert.com/forums/ms-access-forum/)
-   -   Read memo field from database ( MS-Access) (http://www.go4expert.com/forums/read-memo-field-database-ms-access-t19742/)

ceus 12Oct2009 10:21

Read memo field from database ( MS-Access)
 
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 18Dec2010 15:45

Re: Read memo field from database ( MS-Access)
 
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:

Code:

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
  Debug.Print
  rst.MoveNext
Loop
rst.Close
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.


All times are GMT +5.5. The time now is 10:06.