Link to home
Start Free TrialLog in
Avatar of coronoahcoro
coronoahcoroFlag for United States of America

asked on

Notes error: Invalid or nonexistent document ; when unlocking a document

This question is related to this question:
https://www.experts-exchange.com/questions/26551298/Use-color-on-Lotus-Notes-View.html

1. It was working last week and today it is giving me the error message
2. The form was created from a button that contains these code:
     @Command([FileSave]);
     @Command([Compose];"";"FlexRepairProcess");
3. The FlexRepairProcess form created and saved just fine but when I close the form, the code stops at the Queryclose event when it tries to unlock the document
     Sub Queryclose(Source As Notesuidocument, Continue As Variant)
       Dim doc As NotesDocument
       Set doc = source.Document
       Call doc.UnLock
     End Sub

Again this has been working for almost 2 weeks and suddenly it stopped working. I googled this problem and most people have problem with their mail files and that's not the case with me.
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Do you have to unlock it explicitly, isn't the document automatically unlocked? Furthermore, why lock a new document?

If there is indeed a disk-based document (which I doubt), the error could be related to some sort of bug in Notes where it gets confused between two on-screen documents. Sometimes it's worth to grab NotesUIWorkspace.CurrentDocument instead of the Source parameter...
Avatar of coronoahcoro

ASKER

This happens only the very first time after the document is created, saved, and closed. The error doesn't show up anymore afterward. I can open and close document (+ unlocking it) just fine.
I had to do it explicitly because in the past when I tested this, there were times when a document is in locked status even though that doc was saved and close.
I suppose it won't work on a new (or newly saved) document. Can you just leave the lock in that case? Or, dirty: add a line with
      On Error Resume Next
right before the line with Unlock...
ASKER CERTIFIED SOLUTION
Avatar of coronoahcoro
coronoahcoro
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Don't delete the question, for it might help someone else with a similar problem. Just accept your own answer.
ok will do. thanks
This is what works in this case