Trap Document Deletions

I'm looking for a method that can prevent a document from being deleted under certain circumstances. I have a database that keeps track of employee benefits & Insurance plans. I don't want to allow deletions of a plan if it is currently selected on an employee document. I'm running Notes 4.6.1.

How can I trap the deletion from both the Views & the Form? I know I can trap it in the Queryclose event of the form, but how about the view. Also, is there a way to tell if the document is being deleted? (I can't find an @IsDocBeingDeleted function or Object property). Ideally, I check this property, then see if there are any employee records that reference the current document &, if found, set Continue = False to prevent the deletion.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

u have to put the code in the database event:
u find this under design-other-Database script

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RayboneAuthor Commented:
That did the trick!!!


Have a great holiday & survive Y2K
Also use source.documents to capture all the docs that have deletion stub next to them.  Just incase u didnt know this.
Thanx and u too have a merry xmas and a great y2k:)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.