Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2016
    Posts
    2

    Insert more than 255 chars in a Memo field

    Good morning,
    I'm trying to insert data into an existing Ms Access database (.mdb file). When I try to insert programmatically a new record in a table I have a problem with a memo field. It is returned this error:


    "Unable to add the desired amount of data. The field is too small. Try to insert or paste less data"


    I have Googled a lot for this problem but I have found no acceptable solutions for this problem.
    Here the queries used:


    Code:
    1) INSERT INTO tblXXX ([note]) VALUES (?)
    2) UPDATE tblXXX SET [note]=? WHERE YYY=?
    Here the parameters added:


    Code:
    cmd.Parameters.Add("@note", OleDbType.LongVarWChar).Value = part.note;
    cmd.Parameters.Add("@YYY", OleDbType.Char).Value = part.YYY; // Only for the 2nd query
    I have tried/checked the following steps:
    1) Checked the type of the used parameter (OleDbType.LongVarWChar), tried also other types without success
    2) Updated OLEDB drivers to version 16 x64, and updated connection string to use this driver
    3) Created a new .accdb database and imported all tables from the .mdb
    4) Tried to modify the first 8 rows in the table tblXXX, inserting more then 255 chars in the db


    5) Tried to convert the text format of the Memo field to "RTF" (standard value is "normal text")


    But the problem remains, I can insert or update only 255 chars. Can you help me to solve this issue? I have no more tries!
    Thanks in advance


    Paolo Bozzoli

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    In my view, if you are working with mdb, you should be using datatype Memo. Why did you think LongVarWChar
    I'm not sure what drivers or changes you are making??

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,827
    this link may provide a clue - in particular if your ? in your two code options is a concatenation of values

    http://www.allenbrowne.com/ser-63.html

  4. #4
    Join Date
    Jun 2016
    Posts
    2
    Thanks Ajax, this solved my problem. I wrote the query without ? and all works fine!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 07-21-2014, 11:57 AM
  2. Replies: 5
    Last Post: 08-01-2013, 02:21 PM
  3. Excel Import field truncation problem (to Access Memo field)
    By jhrBanker in forum Import/Export Data
    Replies: 6
    Last Post: 07-27-2012, 08:52 AM
  4. Replies: 5
    Last Post: 06-19-2012, 10:46 AM
  5. Replies: 7
    Last Post: 11-30-2010, 12:27 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums