Solved

Testing to see an doc expiry date has elapsed

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now