Solved

Testing to see an doc expiry date has elapsed

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

786 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