Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Location
    Onekama, Michigan, USA
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy field text to the clipboard (A97)

    I have a main form with a command button to open a popup form, (frmRecurEntries) which contains two fields, (fldRecurTitle) and (fldRecurWords). This is a continuous form. Is it possible to select and copy all the text that is contained in the selected field where the cursor is located? By means of pressing one command button on the bottom of the form I would like to copy the field text to the clipboard and then close the popup form. The user would then be returned to the main form to paste the clipboard text as desired.

    Thank you
    Ron

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Copy field text to the clipboard (A97)

    Try this code in the On Click event of the button:

    Screen.PreviousControl.SetFocus
    RunCommand acCmdCopy

    It returns focus to the control that was active before the user clicked the button and copies its contents to the clipboard.

  3. #3
    Star Lounger
    Join Date
    Apr 2002
    Location
    Onekama, Michigan, USA
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy field text to the clipboard (A97)

    I receive the following error popup:
    The command or action "Copy" isn't available now.

    *You may be in a read-only database or an unconverted database from an earlier version
    *The type of object the action applies to isn't currently selected or isn't in the active view

    Use only those commands and macro actions that are currently available for this database

    Thanks
    Ron

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Copy field text to the clipboard (A97)

    The code that I posted assumes that the user clicks in a text box, then clicks the command button.

    If it still doesn't work then, it's probably easier to instruct the user to select and copy (Ctrl+C) the contents himself instead of using a buttton.

  5. #5
    Star Lounger
    Join Date
    Apr 2002
    Location
    Onekama, Michigan, USA
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy field text to the clipboard (A97)

    I agree. A little training with the select and (Ctrl+C) is not that monumental of a task. Thanks for your help.

    Ron

Posting Permissions

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