Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Testing to see an doc expiry date has elapsed

Posted on 2001-09-04
4
Medium Priority
?
183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
martijnmulder earned 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

597 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