How to detect if a doc is 'open' but NOT in the UI (on a tab)?

Has anyone figured out a way to detect if a document is opened but NOT in the UI like on a tab in the background? Technically it’s not in the UI, so getting a uidoc will not work, but it’s also still opened on a tab.

Have a problem where an application has a button on document A, when clicked it updates document B (response doc) with a lot of information including multiple doclinks. There is an issue in that if someone opens document B, then switches over to document A and clicks the button, it creates a rep conflicts because the agent from document A updates it and then the user updates it as well since it is opened. It gets messy to clean it up easily and is a major support problem for us.

I don’t want to get into a major rebuild of this here there is a lot involved I don’t want to get into the details, but if anyone has an idea that I could try to detect if document B is opened in the background when the process is kicked off, then I could prompt the user to close the document before clicking the button or do something similar.

Subject: Also make sure you’ve declared all your var

Ive also found not declaring all the var’s causes the same errors you described when used with the NotesTimer function.

Subject: How to detect if a doc is ‘open’ but NOT in the UI (on a tab)?

Have you tried seeing if you can get a handle to the uidoc? If not, it’s likely not open.

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = workspace.CurrentDocument

if Not (uidoc is Nothing) Then

msgbox(“Please Close UIDOC”)

exit sub

End if

'your code goes here…

Subject: RE: How to detect if a doc is ‘open’ but NOT in the UI (on a tab)?

hmmm, that’s right… you said not uidoc, how about this:turn on documenet locking then at the beginning of your code see if the document is already locked by the user… if not then it won’t matter if the doc is open in another window cause it’s not being edited.

Subject: RE: How to detect if a doc is ‘open’ but NOT in the UI (on a tab)?

Thanks for the suggestions. I’m a little hesitant on doc locking because we turned it on for a few databases and had several support calls about it because it would remain locked even after that person had closed the doc.

Subject: RE: How to detect if a doc is ‘open’ but NOT in the UI (on a tab)?

I solved that problem by adding to the queryclose event, if the uidoc was in edit mode then backenddoc.unlock