Please check the code below, i’m having problem with the notesdocumentcollection. i have 2 DBs: DB2 serves as a lookup database for DB1. The lookup was working properly till i revised something on DB2. The weird thing was in prod the code is not working but in dev it has no problem at all…any ideas is highly appreciated…pls. need help on this.
Also, i am not sure if the problem in prod has something to do with the version…we used notes 7 to replace the design of the 2nd database while the code was originally done in notes 6
Sub GetFldVals
If uidocSource.IsNewDoc Then
docSource.FinalNatureOfIncident = uidocSource.FieldGetText( "NatureOfIncident" )
docSource.OtherFinalNature = uidocSource.FieldGetText("OtherNature")
End If
strIRStatus = uidocSource.FieldGetText( "IRStatus" )
If strIRStatus <> "Cancelled" And strIRStatus <> "Closed" And strIRStatus <> "Resolved" Then
Dim currdb As Notesdatabase
Dim dbAS As Notesdatabase
Dim sessIR As New Notessession
Dim dbcollSys As Notesdocumentcollection
Dim systemname As Variant
Dim docProfile As NotesDocument
Set currdb = sessIR.Currentdatabase
Set docProfile = currdb.GetProfileDocument("frmProfile")
Set dbAS = sessIR.Getdatabase( docProfile.AppSysServer(0), docProfile.AppSysFilename(0) )
systemname = Evaluate(|@Middle("| & uidocSource.Fieldgettext( "AffectedSystem" ) & |";"> ";5000)|)
If Trim(systemname(0)) = "" Then
docSource.SystemName = uidocSource.Fieldgettext( "AffectedSystem" )
Else
docSource.SystemName = systemname(0)
End If
Set dbcollSys = dbAS.Search( |Form = "frmSysName" & BankClass = "| & _
uidocSource.Fieldgettext( "BankClass" ) & |" & SystemName = "| & _
uidocSource.FieldgetText("SystemName") & |"| , Nothing, 0 )
If dbcollSys.Count <> 0 Then
Set docSys = dbcollSys.GetFirstDocument()
strNxtUsr = uidocSource.FieldGetText( "NxtUsr" )
If strNxtUsr <> "SectionHead" And strNxtUsr <> "DeptHead" Then
docSource.AnalystInCharge = docSys.AnalystInCharge(0)
docSource.BackupAnalyst = docSys.BackupAnalyst(0)
End If
If strNxtUsr <> "DeptHead" Then
docSource.SectionHead = docSys.SectionHead(0)
End If
docSource.Department = docSys.Department(0)
docSource.SystemCode = docSys.SystemCode(0)
If docSource.SystemCode(0) = "" Then
docSource.SystemCode = "--"
End If
End If
%REM
THIS IS WHERE THE PROBLEM OCCUR (IN PROD) WHEN DBCOLLSYS.COUNT IS INVOKED, IT SEEMS THAT THE SEARCH IS NOT GETTING ANYTHING, BUT IT WORKS PERFECTLY WELL IN DEV
%END REM
Set dbcollSys = dbAS.Search( |Form = "frmDept" & Department = "| & docSource.Department(0) & |"| , Nothing, 0 )
If dbcollSys.Count <> 0 Then
Set docSys = dbcollSys.GetFirstDocument()
docSource.DeptHead = docSys.DeptHead(0)
End If
End If
End Sub