Solved

Checking if Document has been previously modified before saving!!

Posted on 2001-08-30
4
178 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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
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…

809 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