Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003

    Unanswered: Select text from memo and paste as new record in table


    In a form i have two fields with memo's. Next to each field there is a button.
    The goal is to select some text (one or more words) and press the button which should add the selected text to a new record in another table.

    In a second phase the inserted part from the memo should reformatted differently from the other text of the memo in order to see it's already inserted. But only those words at this location. e.g. if "the" is selected and inserted only this "the" should change to red or italic or whatever and not al the "the"s from the entire text.

    Some help would be very much appreciated!

  2. #2
    Join Date
    Oct 2006
    I'm afraid i'm not too much help, but the first part may be possible by highlighting the data to copy and copy it to the clipboard. From there you could add a command button that would get the data from the clipboard and insert it into a table.

    I don't believe there is a .selectedtext or equivalent feature for a text control.

    The second part I don't think is possible in Access. You are wanting to change formatting on only certain words, as far as I know that is not possible, but I only have Access 2003.

  3. #3
    Join Date
    Sep 2003
    Can't i highlight the text and then include two functions in the button:

    1: clear clipboard and then copy highlighted text to clipboard
    2: insert clipboard content in a new record in a table

    For the second part i can solve this by displaying the inserted text in another color in the form just underneath the memo field.

    for the copying part i've tried something like:

    Function CopyToClipboard() As String
    With Me!cmbList
    .SelStart = 0
    .SelLength = Len(.Value)
    End With
    DoCmd****nCommand acCmdCopy
    End Function

    but without success until now

  4. #4
    Join Date
    Oct 2006
    I believe that would copy everything in the text field, not only your highlighted section.

  5. #5
    Join Date
    Mar 2009
    Provided Answers: 14
    You can easily copy a string to the clipboard using:
    Public Sub CopyToClipBoard(ByVal Text As String)
    ' This function needs a reference to the Microsoft Forms 2.0 Object Library
        Dim MyData As DataObject
        Set MyData = New DataObject
        MyData.SetText Text
        Set MyData = Nothing
    End Sub
    Note: This function works in Access 2003. Other versions of Access could need a reference to a different version of the Microsoft Forms Object Library.
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts