Solved

Checking if Document has been previously modified before saving!!

Posted on 2001-08-30
4
180 Views
Last Modified: 2013-12-18
Hello all

On clicking an 'Approve' button, I'm attempting to check whether the document has already been approved since I opened it and if so, I want to display a message and stop anything else happening.

This is the function I am using to check it.  It's called before anything else happens:-

*******************************************************************

Function CheckStatusChanged(uidoc As NotesUIdocument) As String
     Dim s As New NotesSession
     Dim ws As New NotesUIWorkspace
     Dim doc As NotesDocument, Doc2 As NotesDocument
     Dim db As NotesDatabase
     
     Dim sDocToFind As String
     Dim dc As NotesDocumentCollection
     Dim x As Integer
     
     Set doc = uidoc.Document
     Set db = s.CurrentDatabase
     
     sDocToFind = doc.NoteID
     Set doc2 = db.GetDocumentByID(sDocToFind)
     
     Msgbox "Saved Status: " & doc2.rStatus(0) & Chr$(13) & "Current Status: " & doc.rStatus(0)
     If Not doc2.rStatus(0) = doc.rStatus(0) Then
          CheckStatusChanged = "Yes"    
          Exit Function
     End If    
     CheckStatusChanged = "No"
End Function

******************************************************************

I open the document, someone else opens and approves the same document then when I approve it, it doesn't pick up the fact that the status has changed!!

Anybody got any ideas please?

Thanks in advance

Ian

PS If anyone has problems accessing ExpertsExchange.com at work (like I have for months), use Experts-Exchange.com instead as I guess the hypen stops the word 'sex' being created in the middle!!!
0
Comment
Question by:IanWood
[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
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
martijnmulder earned 100 total points
ID: 6441292
I guess the only thing you really can do is (and this only works when the application only exists on 1 server) create another document (approval document) and look for the existence of that document on approval. e.g. store the document unique id of the original document in the approval document and make that the key in the first column of a view ?

it's a bit more complicated but it should work.

The other option is on approval to close the document and re-open it but that would cause flashing screens....
0
 

Author Comment

by:IanWood
ID: 6441419
Cheers, out of curiousity, if I haven't saved the new document, and I get a new handle on it why doesn't it pick up the later saved version?

0
 
LVL 4

Expert Comment

by:martijnmulder
ID: 6442158
well the document goes from the disc (or nsf) into memory the moment you open it. It does not refresh itself (in memory from disc) until the next time you open it. That's why you get save conflicts when you try to save the same document at the same time.

When you get a new 'handle' on the document you only get a new pointer to the same memory address. This does not update until you close the document.
0
 

Author Comment

by:IanWood
ID: 6444251
Cheers!! I think the approval document sounds like the way to go, as that way I can track all approvals on it..


0

Featured Post

Industry Leaders: 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

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

691 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