< Back

Document Subject: Prevent copying and pasting of documents in a view
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#PreventDocPaste or http://A555F9/nn.nsf/ByAlias/PreventDocPaste

Quick bit of code to prevent pasting of documents.




Open the view you do not want the users to copy and paste the documents into.

Change the Define box to the "Name of view (view)" rather than the "View Selection"

Select the "Query paste" event.

Stick this code in:

  continue=False
 Messagebox "Please do not paste documents. Create new documents!"

 

You can add more code to allow people with the [AllowPaste] role to be able to paste if you want.

This can be useful to allow developers to patch up databases that have become corrupted or out of sync etc

     Dim nv As Variant
    nv = Evaluate("@implode(@userroles;""-"")")
   
    If Instr( nv(0), "[AllowViewPaste]" )=0 Then
         continue=False
         Messagebox "You need the AllowViewPaste role to paste. Please Create new documents!"
    Else
         Print "You have the AllowViewPaste role and so can paste documents."
         continue=True
    End If