Using Memo field

I am making a program that updates a memo field using an adodb recordset.  I need to update the field by adding text to the end.  But when I open the recordset for some reason it overwrites the existing text.  I beleive it has to do with the lockcode.  when I do not set a lockcode I am able to view the memo in a textfield, but I am not able to update the field.  When I set it to any other lockcode I cannot view it, but I can update it but it overwrites the current text.  Here is my code...

    'Open Comments Recordset
    sqlMemo = "SELECT MemoField FROM Comments"
    Set rsMemo = New ADODB.Recordset
    rsMemo.LockType = adLockOptimistic
    Call rsMemo.Open(sqlMemo, connAccounts)

    rsMemo.Fields("MemoField").Value = rsMemo.Fields("MemoFeild").Value & "Updated Text"
    rsMemo.UpdateBatch

This let's me update but overwrites existing data.  HELP!
completefearAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vinnyd79Commented:
is this line just a typo where MemoField is spelled wrong?

   rsMemo.Fields("MemoField").Value = rsMemo.Fields("MemoFeild").Value & "Updated Text"
   
0
completefearAuthor Commented:
it is a typo.  It is correct in my code.  Sorry about that.  I do not get an error becuase of the field name.
0
WHalphenCommented:
The UpdateBatch method requires a LockType of adLockBatchOptimistic.  Try this for your locktype.  
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

WHalphenCommented:
If the LockType of adLockBatchOptimistic does not work try using transactions and the Update method:

connAccounts.BeginTrans
rsMemo.Fields("MemoField").Value = rsMemo.Fields("MemoField").Value & "Updated Text"
rsMemo.Update
connAccounts.CommitTrans

This will provide some shielding between your memo field read and the memo field write, ensuring that the read finishes before the write begins.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gvpathi_devCommented:
The problems are not with Lock Type.  It is with the Memofield type.  Please use getChunk and putChunk of Field object to put data reliably.  If the data size is more than ~>65000 the string will not be concatenated and put back.  

Try with getChunk and putChunk of Field object.  if you have any problem in usage pl. write.

Hope this will solve the problem.

GVPathi
0
cerebralpcCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept  WHalphen  comment as answer.

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
cerebralPC
EE Cleanup Volunteer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.