Non-existent document error?

Hi,

I have a view action to do the following things:

     Dim session As New NotesSession
     Dim dbELF As NotesDatabase    
     Dim colSelection As NotesDocumentCollection    
     Dim docForm As NotesDocument, docYTD As NotesDocument
     Dim docProfile As NotesDocument
     Dim iCount As Integer, iYear As Integer
     
     Dim acl As NotesACL
     Dim aclEntry As NotesACLEntry
     Dim found As Variant
     
     Set dbELF = session.CurrentDatabase
     Set colSelection = dbELF.UnprocessedDocuments
     Set docProfile = dbELF.GetProfileDocument("frmDBProfile","[DbAdmin]")
     Set acl = dbELF.ACL
     Set aclEntry = acl.GetEntry(session.UserName)
     
     iCount = colSelection.Count    
     If iCount = 0 Then
          Messagebox "There are no selected documents to approve.", 64, "Approve Multiple"
          Exit Sub
     End If
     
     Dim iRetVal As Integer
     iRetval = Messagebox ("Do you want to approve these selected applications?", 4+32, "Approve Multiple")
     If iRetval <> 6 Then
          Exit Sub
     End If
     
     Dim k As Integer
     Dim x As Integer
     Dim iExtended As Integer
     Dim iIgnored As Integer
     iExtended = 0
     iIgnored = 0
     If iCount > 0 Then
          Dim itemAuthors As NotesItem
          Dim nameApprover As New NotesName(session.Username)
          Dim sRouting As String
          Print Cstr(colSelection.Count)
          For k = 1 To colSelection.Count
               Print Cstr(k)              
               Dim docMail As New NotesDocument (dbELF)
               Dim rtitem As NotesRichTextItem
               docMail.Form = "Memo"              
               Set rtitem = New NotesRichTextItem(docMail, "Body" )
               Dim docHR As New NotesDocument (dbELF)
               Dim rtitemHR As New NotesRichTextItem(docHR, "Body")
               
               Set docForm = colSelection.GetNthDocument(k)                              
               Dim nameUsr As New NotesName(docForm.txtAuthor(0))
               sRouting =  docForm.txtRoutingDetails(0)
               docForm.txtUpdatedBalance  = "NO"
               Set itemAuthors = docForm.GetFirstItem("listAuthors")
               
               If docForm.txtLeaveRef(0) = "Annual" Or docForm.txtLeaveRef(0) = "Maternity" Then                                        
                    If (nameApprover.Canonical = docForm.namSubmitTo(0)) Or (nameApprover.Canonical = docForm.namSubmitCover(0)) Then                        
                         Set itemAuthors = docForm.GetFirstItem("listAuthors")          
                         If itemAuthors.Contains("[HRAdmin]") = False Then
                              Call itemAuthors.AppendToTextList("[HRAdmin]")
                         End If
                         iYear = Year(Cdat(docForm.txtFirstDate(0)))
                         Set docYTD = GetStaffConsumptionProfile(docForm.txtAuthor(0), Cstr(iYear))
                         
                         If docForm.txtStatus(0) = gcAdSubmitted Then        'LEAVE ADJUSTMENT
                              docForm.txtStatus = gcApproved
                              sRouting = sRouting & "Leave Adjustment approved by " & nameApprover.Abbreviated & " on " &  Format$(Cstr(Now),"dd mmm yyyy  hh:mm")
                              docForm.txtRoutingDetails = sRouting & Chr$(10)
                              'UPDATE STAFF CONSUMPTION PROFILE                              
                              If Not (docYTD Is Nothing) Then
                                   docYTD.iConsumed_1 = docYTD.iConsumed_1(0) - docForm.txtTotalCancel(0)
                                   If docForm.satcancel(0) <> "0" Or docForm.satcount(0) <> "" Then
                                        docYTD.sat = Cstr(Csng(docYTD.sat(0)) - Csng(docForm.satcancel(0)))
                                        docForm.Totalsatcancel = docForm.satcancel(0)
                                        docForm.satcancel = "0"
                                   End If
                                   Call docYTD.save(True, False)
                              End If
                              docForm.TotalCancelDur = docForm.TotalCancelDur(0) + docForm.txtTotalCancel(0)
                              docForm.txtTotalCancel = 0
                             
                              docMail.SendTo = docForm.txtAuthor(0)
                              docMail.CopyTo = docForm.readerlist                                                  
                              docMail.Subject = "Leave Adjustment was approved for " + docForm.txtName(0)
                              Call rtitem.AppendText("Please click on doclink to view the document. ")
                              Call rtitem.AppendDocLink (docForm, "Please click on the doclink to process the document")              
                              Call rtitem.AddNewLine( 1)              
                              Call rtitem.AppendText("Please check comments column")
                              Call docMail.Send(False)
                             
                              docHR.Form = "Memo"                        
                              docHR.SendTo = docProfile.txtProfLeaveHR
                              docHR.Subject = "FYI - Leave Adjustment was approved for " + docForm.txtName(0)
                              Call rtitemHR.AppendText("Please click on doclink to view the document. ")                              
                              Call rtitemHR.AppendDocLink (docForm, "Please click on the doclink to view the document")
                              Call docHR.Send(False)
                         Elseif docForm.txtStatus(0) = gcSubmitted Then
                              docForm.txtStatus = gcApproved
                              sRouting = sRouting & "Approved by " & nameApprover.Abbreviated & " on " &  Format$(Cstr(Now),"dd mmm yyyy  hh:mm")
                              docForm.txtRoutingDetails = sRouting & Chr$(10)                              

                              docMail.SendTo = docForm.txtAuthor(0)
                              docMail.CopyTo = docForm.readerlist                                                  
                              docMail.Subject = docForm.txtLeaveType(0) + " application was approved for " + docForm.txtName(0)
                              Call rtitem.AppendText("Please click on doclink to view the document. ")
                    'THE NON-EXISTENT DOCUMENT ERROR OCCURS AT THE BELOW LINE!!!!!      
                              Call rtitem.AppendDocLink(docForm, "")
                              Call docMail.Send(False)
                              docHR.Form = "Memo"
                              docHR.SendTo = docProfile.txtProfLeaveHR
                              docHR.Subject = "FYI - " + docForm.txtLeaveType(0) + " application was approved  for " + docForm.txtName(0)
                              Call rtitemHR.AppendText("Please click on doclink to view the document. ")                              
                              Call rtitemHR.AppendDocLink(docForm, "")
                              Call docHR.Send(False)
                         End If                                                                          
                    End If
                    End If
          Next
     End If

The above is part of my coding in the action button.
I'm the manager of this db, and when I try this button, it doesn't give the error message. However, all my users get this error. They are editors for this db.

Please look for the comment line " 'Non-existence document error occurs.....' " in the above coding. The line that causes the problem is the line below my comment.

Hope someone can give some solution!
Thanks.
kspueaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ghassan99Commented:
are there views in this db that are personal and saved on the desktop?
0
kspueaAuthor Commented:
Yes, it is a personal view that stored on the user's desktop.
Is it because of that, that's why I get this error message?

0
ghassan99Commented:
yes, most probably. it will not be a problem if the view is shared or stored on the server.  I suggest to create a copy of the db, and delete those view or recreate them as private but on the server, and test.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

kspueaAuthor Commented:
but how do I delete/refresh the personal views that stored on the server? Is there any way?
0
ghassan99Commented:
its hard actually to deal with personal views created on the server. its up to the user to delete it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kspueaAuthor Commented:
Thanks, ghassan99!! :-)
0
ghassan99Commented:
it worked? it doesnt give the error message anymore?
0
kspueaAuthor Commented:
No, I can not allow users to store their personal views on server, because it'll be very difficult to me if I were to change the view design in future.
Anyway, I have changed it to shared view after I discussed with my users. :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.