Could you paste your view's QueryPaste-code here, maybe?
Main Topics
Browse All TopicsHi,
I have written a small script library to handle pasting into views in Lotus Notes.
If I use the library code directly in the view's QueryPaste event it will work and the document will not be pasted.
If I use the code in a library the document is still pasted after the code has run...
Now, I'm pretty sure this is because the continue = false is not globally recognised between the QueryPaste event and the script library call.
My question is therefore... How can I pass the value of continue back to the QueryPaste event after my call to the script library?
OR...
How can I terminate all code at the point of realising the document should not be pasted?
I should perhaps explain that I have around 100 views in this database and I am checking the current user against another database to see if they have access to paste documents.
I would prefer to set this up in a library so I do not have to repeat and maintain the same code across 100 views.
Thanks for your help in advance!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Unfortunately I don't know of a way to include this without touching every view. However once the groundwork is laid in each view you will only have to make code changes to one location...
You need to create a Script Library => MyScriptLibrary
Include the Sub MyQuerypaste(Source As Notesuiview, Continue As Variant) as mentioned by sjef in MyScriptLibrary
In each view that you want this to pertain to you must:
Add the following line to the Global -> OPTIONS section of the view:
Use "MyScriptLibrary"
Add the forementioned call statement to the QueryPaste section => Call MyQuerypaste(Source, Continue)
I see you already got a few answers, so I'll join in.
Sub StopPasting checks the user's organizational unit to determine whether he can paste (copy) documents.
As it's already said, you have to pass Continue as an argument and since it's passed by reference, it will be changed and it'll affect the QueryPaste outcome.
As I understood, reading shuborader's question, my guess is that he did not send Continue as an argument, but just hoped he could change it as a global (lib) variable from the lib's function.
Sjef,
I didn't know you can call the method like that. Maybe you meant like this, without parentheses:
MyQuerypaste Continue
like Msgbox is often called?
Oh, I see (from Designer help):
For a sub or a function, do not use parentheses around the argument list (Syntax 2) unless you are passing a single argument by value to the sub or function (Syntax 3).
Syntax 1
Call subOrFunction [ ( [ argList ] ) ]
Syntax 2
subOrFunction [ argList ]
Syntax 3
subOrFunction ( argPassedByVal )
Syntax 4 (functions only)
returnVal = function [ ( [ argList ] ) ]
Indeed. Assuming that the subroutine MyQuerypaste alters the value of its first parameter, you'll see that calling the sub like
MyQuerypaste(Continue)
won't change the value of Continue, whereas
Call Querypaste(Continue)
does modify the value.
The difference is that the first call the parameter is passed by value (since it is an expression).
You could say I stumbled... I was developing a subroutine, defined as
Sub QSort(somearray As Variant)
I called it as
QSort(myarray)
and I have been debugging for the best of a day to try to understand why I didn't get a sorted array back, while right at the end of the sub the contents of the array was completely sorted.
All I had to do was change the call into
Call QSort(myarray)
or
QSort myarray
From that time, I ALWAYS use the word Call when calling a subroutine.
Hey, I'm old school, I used a lot of C: no "Call", only pass by value, easy...
Business Accounts
Answer for Membership
by: sjef_bosmanPosted on 2009-09-21 at 08:33:15ID: 25383966
Declare your function as
Sub MyQuerypaste(Source As Notesuiview, Continue As Variant)
and calll your function from the view's QueryPaste event with
Call Querypaste(Source, Continue)
These variables aren't global indeed, so you have to pass them.