Read memo field from database ( MS-Access)

Discussion in 'MS Access' started by ceus, Oct 12, 2009.

  1. ceus

    ceus New Member

    Joined:
    Oct 16, 2006
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    0
    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...
     
  2. apr pillai

    apr pillai New Member

    Joined:
    Dec 17, 2010
    Messages:
    16
    Likes Received:
    12
    Trophy Points:
    0
    Occupation:
    Auditor
    Location:
    India
    Home Page:
    http://www.msaccesstips.com/
    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.
     
    shabbir likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice