Subject: RE: Db.open
- First, this line of code is too much:
Call dbDataDict .Open(session.currentDatabase.server, strDataDictFilePath)
You already have set the database to the current database, so it just needs to be:
Call dbDataDict .Open(dbManDef.server, strDataDictFilePath)
- You need to do a boolean test as someone stated elsewhere in this thread:
if dbDataDict.isopen then
Do your stuff
else
Messagebox “Unable to open database”
End if
If you are getting this it means one of two things:
a. The signer of the agent (or the person running it if manual) does not have proper access to the database.; or
b. The database does not exist in that path.
You are better off having profile documents that store the needed databases and a field containing their replica ID (without the “:”). That way you do not need to worry about where the database is stored:
Dim dbDataDict As New NotesDatabase(“”,“”)
if dbDataDict.openbyreplicaID then
Do your stuff
else
Messagebox "Unable to open database"
End if
NOTHING like this kind of information should be hard coded in script or formulae.
- Think about rearranging the way you code your script so it flows like someone would read it without having to hunt through code to find where things are set:
Dim session As New NotesSession
Dim dbManDef As NotesDatabase
Set dbManDef = session.CurrentDatabase
'GET THE APPLICATION PROFILE DOCUMENT
Dim viewAppProfiles as NotesView
set viewAppProfiles=dbManDef.getView(“luvaAppProfiles”)
dim docAppProfile as Notesdocument
set docApprofile=viewAppProfiles.getdocumentbyKey(_
“Data Dictionary”,true)
if not (docApprofile is nothing) then
Dim viewManDef As NotesView
Set viewManDef = dbManDef.GetView(“warning”)
Dim docManDef As NotesDocument
Set docManDef = viewManDef. GetFirstDocument
Dim dbDataDict As New NotesDatabase(“”,“”)
If dbDataDict.OpenByReplicaID( dbDataDict.server, _
docApprofile.ReplicaID(0)) Then
Dim viewDatadict As NotesView
set viewDataDict=dbDataDict.getview_
(docApprProfile.LookupView(0)
Dim docDataDict As NotesDocument
etc etc)
Hope this helps…