I believe the offending line is:“If (cARR(i) = useroffice) And (nARR(i) = policy) Then”
but I’m not sure
Option Public
Option Explicit
Const nab_server = “Hercules/RDS”
Const nab_path_and_file = “names.nsf”
Const lookup_server = “Athena/RDS”
Const lookup_path_and_file = “newNAS\AdmnTask.nsf”
Const lookup_view = “IT Office”
Const FILE_PATH=“d:\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")
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) & " Date: " & Today()
Print #1, "Building Certifier to Notes Server mapping array ..."
Forall view In LU.views
If view.Name = ("IT Office") Then
Set array_doc = view.GetFirstDocument
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)
End If
If (Instr(array_doc.Notes_Server(0), "/") >0) Then
nARR(i) = Left(Right(array_doc.Notes_Server(0), 10), 3)
Else
nARR(i) = array_doc.Notes_Server(0)
End If
Print #1, "Certifier: " & cARR(i) & ", Notes Server: " & nARR(i)
Set array_doc = view.GetNextDocument(array_doc)
i = i + 1
Wend
End If
End Forall
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
counter=0
While Not (person Is Nothing)
counter=0
'Criteria which would EXCLUDE document from report
If (Instr(person.MailAddress(0), "brightmail") >0) Then
counter = 1
End If
If (Instr(person.MailServer(0), "LNSHHQ02M") >0) Then
counter = 1
End If
If (Instr(person.MailServer(0), "LNSHHQ03M") >0) Then
counter = 1
End If
If (Instr(person.MailServer(0), "NotesGate01") >0) Then
counter = 1
End If
'Getting the Fullname Office and the Policy Office
Set username=New notesname(person.fullname(0))
'Print #1, "Checking..."+Username.Abbreviated
useroffice = Strleft(Strrightback(Cstr(person.fullname(0)), "OU="), "/")
If (Instr(person.Policy(0), "/") >0) Then
policy = Right(person.Policy(0), 3)
Else
policy = person.Policy(0)
End If
If (useroffice = policy) Then
counter = 1
End If
Dim certifier As String
If (person.form(0)="Person") Then
i = 0
Do While i <= Ubound(cARR)
If (cARR(i) = useroffice) And (nARR(i) = policy) Then
counter = 1
Exit Do
End If
Loop
End If
userstring = Cstr(person.fullname(0))
If (counter = 0) Then
Print #1, "*****************************************!!!!!!!"+ " Office = " + useroffice + ", Policy = " + policy
Else
Print #1, "Counter=" & Cstr(counter) & ", MailAddress=" & person.MailAddress(0) & ", MailServer=" & person.MailServer(0) & ", UserOffice=" & useroffice & ", Policy=" & policy
End If
Set person=nab_dc.GetNextDocument(person)
Wend
'People who will receive this memo:
Dim recipients(3) As String
recipients(0)="Michael T Chang"
' mail off the memo
Set this_db = session.CurrentDatabase
Dim doc As notesdocument
Set doc = New NotesDocument( this_db )
doc.form="Memo"
doc.subject="Daily Incorrect Policy Report"
Dim rtitem As NotesRichTextItem
Set rtitem = New NotesRichTextItem( doc, "Body" )
Dim object As Variant
Set object = rtitem.EmbedObject( EMBED_ATTACHMENT, "", FILE_PATH)
Call doc.send(False,recipients)
End Sub
any ideas on what I’m doing wrong?
thks,
-MC