Solved

Testing to see an doc expiry date has elapsed

Posted on 2001-09-04
4
176 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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