I have a simple button that, when clicked, is supposed to launch a new email document with a doclink in the body area. On clicking the button I get the following Notes Error message: “Couldn’t get default view id for database”.
After making a local copy of the DB, I went back to the list of views and there was no indication of a default view in the list. I then changed the properties of the “All” view so that it would become the “Default design for new folders and views”. I still do not see that blue symbol in the list of views next to the view name – this is supposed to indicate that it is the default view.
Even after changing the view’s properties I still get the same error message. Is there anything I am not doing right here? I doubt its in the code. Can someone help me?
Sub Click(Source As Button)
Dim workspace As New notesuiworkspace
Dim session As New notessession
Dim uidoc As notesuidocument
Dim Newuidoc As notesuidocument
Dim CurrItem As Variant
Dim Listitem As Variant
Dim object As NotesEmbeddedObject
Dim Db As notesDatabase, CurrDb As notesdatabase
Dim View As notesview
Dim sEmailType As String
Dim Doc As notesDocument, MailDoc As notesDocument, EmpDoc As notesDocument
Dim richStyle As NotesRichTextStyle
Set richStyle = session.CreateRichTextStyle
Set CurrDb = session.currentdatabase
Set uidoc = workspace.currentDocument
Set Currdoc = uidoc.document
mName = Evaluate({@MailDBName})
'mName(0) --> will have the Server Name
'mName(1) --> will have the Mail DB Path
Mailserver = mName(0)
Mailfile = mName(1)
Set Db = New notesdatabase(Mailserver,Mailfile)
If Not Db Is Nothing Then
Set maildoc = New notesdocument(db)
maildoc.form = "Memo"
'xxxxxxxxxxxxxxxxxxxxxxxx
Set bodyField = New NOTESRICHTEXTITEM(maildoc, "Body")
maildoc.SendTo = ""
maildoc.Subject="Project - " & CurrDoc.PrjTitle(0)
maildoc.From=Session.usernamelist(0).common
richStyle.NotesColor = COLOR_Black
richStyle.NotesFont = STYLE_NO_CHANGE
Call bodyField.AppendStyle(richStyle)
Call bodyField.ADDNEWLINE(2)
Call bodyField.APPENDTEXT("Project Document Link: ")
Call bodyField.AppendDocLink( CurrDoc,"Link")
Call bodyField.ADDNEWLINE(2)
Call maildoc.computewithform(False, False)
End If
Set Newuidoc = workspace.editdocument(True,maildoc)
Call newuidoc.gotofield("EnterSendTo")
End Sub