Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2005
    Location
    San Jose, Costa Rica
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Prevent copy/paste from datasheet subform (Office

    Hi, guys.

    I have a form with a subform in datasheet view that is filtered by controls on the main form. I would like to keep users from selecting and copying the records in the sub form into excel or anywhere else. Even though all the controls on the subform are locked and disabled, you can still select all the records and use "CTL+C" to copy the records. I've tried a couple of different things using the EmptyClipboard API call in conjunction with various keystrokes and I've tried to access the office clipboard but with no success. Any ideas?

    Scott.

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

    Re: Prevent copy/paste from datasheet subform (Office

    Welcome to Woody's Lounge!

    You could set the Enabled property of the subform to No, but that is probably too drastic (the users wouldn't be able to scroll the subform)

  3. #3
    New Lounger
    Join Date
    Mar 2005
    Location
    San Jose, Costa Rica
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prevent copy/paste from datasheet subform (Off

    Thanks, Hans. You gave me a good idea.

    I used the keydown event of the subform to trigger a function if the keydwon is the control key. It does this:
    1. disables the subform (which does a good job of clearing the selection)
    2. displays a message (directs them to use the export funtion which is tied to the currentuser)
    3. enables the subform
    4. sets the focus to a control on the mainform.

    It seems to work fairly well. I had tried just a message box when the control key is down but if you are persistant, you can still copy the data. Of course, you also have to disable the shorcut menu as well.

    Thanks for your help.

    Scott.

Posting Permissions

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