• How to append more lines at the end of a memo fiel (97)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » How to append more lines at the end of a memo fiel (97)

    Author
    Topic
    #374382

    How to append more lines at the end of a memo field?
    I have table field called NOTES which I use to write various notes, sometimes the same note is stretched across several records & I would like to be able to append it to the records using an update query. However, if any of the affected records already contain pre-existing notes then I

    Viewing 1 reply thread
    Author
    Replies
    • #605503

      Did you get an anwer from me already on this? I remember sending it to you, but I don’t see it posted. Let me know, and I’ll redo it if necessary.

      • #605504

        no answer.

        • #605552

          Okay, let’s try this again!

          First you need a way to put vbCrLf in a query. Access doesn’t recognize that in a query. You could try to remember the character codes, but that takes too much of my precious memory. I create a simple function that I stick in a module. It looks like this:

          Public Function nl( )
          nl = vbCrLf
          End Function

          Now in your query, your “Update to” field will look like this:

          MemoField + nl( ) & “The stuff you wanted to add.”

          Using the “+” solves the problem of starting the field with a blank line if the memo field is null. Anything added to null produces a null.

    • #605521

      I haven’t tested this just now, but I would expect this to work:

      In the update to row put:
      [mymemo] & VBCRLF &

      • #605526

        NOTE: This will work but not in an action query. You can’t use named constants like vbCrLf in a query expression. Recommend replace vbCrLf with Chr() function. Example:

        [fldMemo] & Chr(13) & Chr(10) & "Enter new comment for memo field here."

        Where [fldMemo] is existing memo field when records updated. Chr(13) = Carriage return, Chr(10) = Linefeed.

        HTH

    Viewing 1 reply thread
    Reply To: How to append more lines at the end of a memo fiel (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: