Solved

Testing to see an doc expiry date has elapsed

Posted on 2001-09-04
4
179 Views
Last Modified: 2013-12-18
Hi there hope you can help

When opening a document what's the best way to test the value of a @Created field on the doc and if that field is more than 5 days older than today's date do not allow the user to open the document?

Many thanks in advance

Gary
0
Comment
Question by:Gary_Garnett
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
martijnmulder earned 100 total points
ID: 6453352
just stick this code in the queryopen of the form:

     Dim daysold As Double
     If Not (source.document Is Nothing) Then
          daysold =source.document.createdDay(0)
          If Now - daysold > 5 Then
               continue = False
          End If
     End If
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6453366
Hello Gary

This queryopen event script will block the expired docs from opening

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
     Set doc = Source.Document
     Dim created As New NotesDateTime(doc.Created)
     Dim current As New NotesDateTime(Today)
     Diff = current.TimeDifference(Created) / 86400
     If Diff > 5 Then
          Msgbox "Document Expired !", 16, "Cannot Open"
          Continue = False
     End If
End Sub

~Hemanth
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6453390
Gary, there is a small bug in the code replace it with this

     If Not Source.IsNewDoc Then
          Set doc = Source.Document
          Dim created As New NotesDateTime(doc.Created)
          Dim current As New NotesDateTime(Today)
          Diff = current.TimeDifference(Created) / 86400
          If Diff >= 4 Then
               Msgbox "Document Expired", 16, "Cannot Open"
               Continue = False
          End If
     End If

0
 

Author Comment

by:Gary_Garnett
ID: 6453631
Thanks so much for your help

Regards

Gary
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question