1

In LotusScript (Domino 12.0.1FP1, Notes 12.0.1) we prepare a Memo in the user's mail database. Sometimes, the above error pops up: Specified database is not currently open: Server/ORG mail.box It happens when the user clicks Send in the Notes client. It works for me on my system, so I cannot reproduce the error here. AFAIK, the code doesn't even work with mail.box directly, so can someone help me finding out where the error comes from?


UPDATE


Set maildb= Applications.getDb(MYMAIL)
Set memo= New NotesDocument(maildb)
Call memo.ReplaceItemValue("Form", "Memo")
Call memo.ReplaceItemValue("SendTo", sendTo)
Set exporter= New DocGenerator(topic)
Set exporter.TemplateDatabase= tdb
Call exporter.Open("Notes", doc)
Call exporter.SaveToDocument(memo, "Body")
Set body= memo.GetFirstItem("Body")
Call body.AddNewline(2)
If metbrief Then 
    Call body.AppendRTItem(doc.GetFirstItem(rtname))
    Call body.AddNewline(2)
End If
If extra<>"" Then
    Call body.AppendRTItem(doc.GetFirstItem(extra))
    Call body.AddNewline(2)
End If
Call appendUserMailSignature(body)
Call memo.Save(True, False)
Call ws.EditDocument(True, memo)
Call uiDoc.Close

Notes:

  • the correct mail database is opened (Applications is a Singleton)
  • DocGenerator is a class that uses Notes (in this case) and a template database to generate text (it can also use OpenOffice)
  • that text is collected in a NotesDocument private to the generator
  • SaveToDocument appends the contents of that private NotesDocument to the memo field
  • rtname and extra are two more RT-fields in the current document
  • AppendUserMailSignature, eh, well, it does what it says
  • the memo is saved as Draft and opened on the screen
  • only then, when the user clicks Send, the message appears

UPDATE


Cannot detach a PDF file

The database that cannot be opened isn't even mentioned, so I wonder whether the original error with mail.box is accurate or not. I'll ask the user to show me what she does exactly.

Ben
  • 7
  • 3
D.Bugger
  • 2,300
  • 15
  • 19
  • Tell us more about how you are preparing the memo. – Richard Schwartz Sep 23 '22 at 14:00
  • check the current location settings – Thomas Adrian Sep 24 '22 at 08:11
  • I'll update the question. By the way, it happened to more than one person, which makes it unlikely that there's a problem with the Location settings. Anyway, how and why would someone put mail.box in their Location settings?? – D.Bugger Sep 24 '22 at 19:33
  • 1
    I'm suspicious of that uidoc.Close call at the end. Everything before that point is using back-end classes, not UI classes. You are calling it immediately after you do the EditDocument operation. Is there anything actually assigned to uidoc? What are you closing. Do you have Option Declare turned on? – Richard Schwartz Sep 26 '22 at 01:25
  • This code is called from a document open in a form. That uidoc.Close at the end is supposed to close the current document and display the mail instead, so the user doesn't have to close the first document by hand. It works everywhere else, so why not here? Thanks to your brilliant magical crystal ball view I just discovered that, upon returning from this code, the calling Sub executes another uidoc.Close ! I'm an oaf... THANKS!! – D.Bugger Sep 27 '22 at 08:27
  • Hm, I still fail to see where in the end it goes wrong. I removed the double Close, I'll have to wait and see what the users report back to me. Can't test this myself, unfortunately. – D.Bugger Sep 27 '22 at 08:37
  • New test results: same error. I'd gladly have added error trapping code, but the error occurs in the mail database and I really do not want to debug that thing... – D.Bugger Sep 28 '22 at 08:46

1 Answers1

0

Solved. Code in the main document's form prepared a rich-text field with an attachment.

' reopen doc, to "fix" rich text...
Dim db As NotesDatabase

Set db= doc.ParentDatabase
id= doc.NoteId
Delete uidoc ' implies Delete doc
Set doc= db.GetDocumentByID(id)

Now the doc is fully refreshed and contains a valid rich-text field.

D.Bugger
  • 2,300
  • 15
  • 19