Can anyone pinpoint why this code generates the “Subscript out of range” error?
Option Public
Option Explicit
Const nab_server = “Athena/RDS”
Const nab_path_and_file = “names.nsf”
Const lookup_server = “Hercules/RDS”
Const lookup_path_and_file = “newNAS\AdmnTask.nsf”
Const lookup_view = “IT Office”
Const FILE_PATH=“c:\export\IncorrectPolicy_Report_Array.txt”
Sub Initialize
'On Error Resume Next
Dim this_db As notesdatabase
Dim session As New notessession
Dim NAB As notesdatabase
Dim LU As NotesDatabase
Dim person As NotesDocument
Dim IT_Office As NotesDocument
Dim array_doc As NotesDocument
Dim people_view As notesview
Dim cARR() As String
Dim nARR() As String
Dim i As Integer
Dim lookup_view As NotesView
Set this_db=session.CurrentDatabase
Dim log_doc As notesdocument
Set LU=session.getdatabase(lookup_server, lookup_path_and_file,False)
Set lookup_view = LU.GetView("IT Office")
Set NAB=session.getdatabase(nab_server, nab_path_and_file,False)
Dim nab_dc As notesdocumentcollection
Set people_view = NAB.GetView("People")
Set nab_dc=NAB.AllDocuments
Set person = nab_dc.GetFirstDocument
i = 0
Redim cARR(0)
Redim nARR(0)
Dim counter As Integer
Dim username As NotesName
Dim userstring As String
Dim useroffice As String
Dim policy As String
Open FILE_PATH For Output As #1
Print #1, "Incorrect Archive Policy Report: " & Cstr(LU.Title)
Forall view In LU.views
Print #1, "got past the LU.Views Forall"
If view.Name = ("IT Office") Then
Print #1, "Got past the view.Name is IT office"
Set array_doc = view.GetFirstDocument
While Not array_doc Is Nothing
Print #1, "Entering the while not array doc is nothing"
Redim Preserve cARR(i)
'Redim Preserve nARR(i)
If array_doc.Certifier(0) = "HQ" Then
cARR(i) = "HHQ"
Else
'cARR(i) = array_doc.Certifier(0)
cARR(i) = "test"
End If
'If (Instr(array_doc.NotesServer(0), "/") >0) Then
' nARR(i) = Left(Right(array_doc.NotesServer(0), 10), 3)
'Else
'nARR(i) = array_doc.NotesServer(0)
' nARR(i) = "NQ?"
'End If
i = i + 1
'Print #1, "Certifier: " & cARR(i) & ", Notes Server: " & nARR(i)
Print #1, "Certifier: " & cARR(i)
Set array_doc = view.GetNextDocument
Wend
End If
End Forall
End Sub