I encounter the error msg:“Database MOEA003!!\project\zs\sars.nsf has not been open yet” when i running the following code in the agent,
i want to get the database in another server,
server name is :MOE003/MOE/A
path is :project\zs\sars.nsf
Any help will be greatly appreciated.
Sub Initialize
'One time loading of school information from SARS database
Dim db As Notesdatabase
Dim Session As New NotesSession
Dim view As NotesView
Dim doc As NotesDocument
Dim itemAuthor As NotesItem, itemReader As NotesItem
Set db = Session.currentdatabase
Set view = db.GetView( “vwSchList” )
'For SchoolInfo form in Sars db
Dim SARSdb As notesdatabase
Dim SARSview As notesView
Dim SARSdoc As NotesDocument
Dim key As String
Dim counter As Integer
Set SARSdb = session.GetDatabase (“MOE003”, “\project\zs\sars.nsf”)
Set SARSview= SARSdb.GetView( “vSchoolInfoLkup” )
Set SARSdoc = SARSview.GetFirstDocument
counter = 0
'Loading starts
While Not ( SARSdoc Is Nothing )
counter = counter + 1
key = SARSdoc.Schcode(0)
Set doc = view.GetDocumentByKey( key , True )
'if school info doc does not exist
If ( doc Is Nothing) Then
Set doc = New NotesDocument ( db )
doc.Form = “SchList”
doc.SchoolCode = key
End If
'Update info if school info doc already exists
doc.SchoolName = SARSdoc.SchName(0)
Call doc.save( True, True )
Set SARSdoc = SARSview.GetNextDocument( SARSdoc )
Print "Counter : " & Cstr(counter)
Wend
Msgbox “Loading of school code and name has completed.” , MB_OK, “Information”
End Sub