• Memo Field

    Author
    Topic
    #356035

    I’m using Access 97. I need a button for a form that, when clicked, will go to the end of a memo field and execute the equivalent of two carriage returns (like leaving a blank line between the old data and the new) and stop there waiting for further data entry. Any ideas are appreciated. Thanks in advance!

    Viewing 0 reply threads
    Author
    Replies
    • #526252

      Try this in the click event of the button:

      Me.txtDescription.SetFocus
      SendKeys “{F2}”
      SendKeys “^{ENTER}”
      SendKeys “^{ENTER}”

      where txtDescription is the name of the control bound to the memo field.

      • #526283

        Here’s a sample Access 97 database that contains a form used to edit a memo field. It allows the user to simply hit enter to break the paragraph and does a few other interesting things as well, including allowing tabs in the field. I haven’t played with this for a while, so don’t expect too much of it. grin

        • #526313

          Thank you very much!

        • #526460

          Charlotte: Thank you … your sample was exactly what I needed to satisfy a customer request to press Enter in a memo field (my memo field is named Notepad). I added the following code to the OnEnter event of the memo field so that a return/CurrentDate/:/space would be placed on a new line each time the user entered the field to add a subsequent note. The cursor then goes to the end of the current line, so the user can begin typing.

          Private Sub Notepad_Enter()

          Dim vDate As Date
          Dim vColon As String

          vDate = Format(Date, “Short Date”)
          vColon = “: ”

          Me![Notepad] = Me![Notepad] & vbCrLf & vDate & vColon
          Me![Notepad].SelStart = Len(Me![Notepad]) + 1

          End Sub

          So far, so good. The problem is that placing the cursor at the end automatically scrolls the text box down, so that only the current date line is visible, even if there is plenty of space in the text box to see the entire contents of the memo field. The user has to scroll up to see prior notes. Is there a way to stop that from happening, that is; place the cursor at the current line without scrolling down unless it is necessary?

    Viewing 0 reply threads
    Reply To: Memo Field

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

    Your information: