SandraE
asked on
I have a lotus script question ...
I want a button to paste into an email message. The button should open a specific database. The db is not in a consistent place on the servers, and some people do have the db locally, so I need my statement to be:
.. if db.server = "" then open discussion.nsf
.....if this fails, display message and quit
.. if db.server != "" then open db.server, discussion.nsf
.....if this fails, then open db.server, home\discussion.nsf
.....if this fails, display message and quit
message: "You need to connect to your office's server to open this database."
This is the code I am starting with is below.
Thanks much,
SandraE
-------------------------- ---------- -----
Dim workspace As New NotesUIWorkspace
Dim session As New notessession
Dim db As notesdatabase
Dim uidoc As NotesUIDocument
Dim twoliner As String
Set db = session.currentdatabase
'determine whether or not the user is using a database on the server
If Not db.server="" Then
Call workspace.OpenDatabase ( db.server, "home\discussion.nsf","Bul letin Board\By Category",,False, False)
Else
twoLiner = |You need to connect to your office's server to open this database.|
Messagebox twoLiner, MB_ICONINFORMATION, "You are not connected to the server."
End If
-------------------------- ---------- -----
.. if db.server = "" then open discussion.nsf
.....if this fails, display message and quit
.. if db.server != "" then open db.server, discussion.nsf
.....if this fails, then open db.server, home\discussion.nsf
.....if this fails, display message and quit
message: "You need to connect to your office's server to open this database."
This is the code I am starting with is below.
Thanks much,
SandraE
--------------------------
Dim workspace As New NotesUIWorkspace
Dim session As New notessession
Dim db As notesdatabase
Dim uidoc As NotesUIDocument
Dim twoliner As String
Set db = session.currentdatabase
'determine whether or not the user is using a database on the server
If Not db.server="" Then
Call workspace.OpenDatabase ( db.server, "home\discussion.nsf","Bul
Else
twoLiner = |You need to connect to your office's server to open this database.|
Messagebox twoLiner, MB_ICONINFORMATION, "You are not connected to the server."
End If
--------------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This is easy enough:
get the current database, use its db.server which will be either "" or servername, so you don't need to test for that. Attempt at first location, if it fails attempt at second location, if that fails produce the error block.
sub click()
dim session as new notessession
dim db as notesdatabase
set db=session.currentdatabase
dim discdb as notesdatabase
set discdb = new notesdatabase(db.server, "discussion.nsf")
if discdb is nothing then set discdb = new notesdatabase(db.server, "home\discussion.nsf")
if discdb is nothing then msgbox("You need to connect to your office's server to open this database."
end sub
get the current database, use its db.server which will be either "" or servername, so you don't need to test for that. Attempt at first location, if it fails attempt at second location, if that fails produce the error block.
sub click()
dim session as new notessession
dim db as notesdatabase
set db=session.currentdatabase
dim discdb as notesdatabase
set discdb = new notesdatabase(db.server, "discussion.nsf")
if discdb is nothing then set discdb = new notesdatabase(db.server, "home\discussion.nsf")
if discdb is nothing then msgbox("You need to connect to your office's server to open this database."
end sub
My proposal did the same :-)
I only added extra replica id to reduce the hassle by one more level.
I only added extra replica id to reduce the hassle by one more level.
ASKER
I have HermanthaKumar's suggestion out in testing . . I'll let you know how it works as soon as I hear back. thanks to all
ASKER
this was one of those things they had to have, and then didn't give me the final "ok" till now. so, they are happy, so I'm happy too. Thanks to Zvonko and Andrew. They accepted Herman's code, so I stopped there. You guys are great. thanks!
how about this aproach:
Sub Click(Source As Button)
Dim session As New notessession
Dim db As notesdatabase
Set db = session.CurrentDatabase
Dim searchDB As New NotesDatabase( "", "" )
If Not searchDB.OpenByReplicaID( db.Server, "85255FA900747B84" ) Then
twoLiner = |You need to connect to your office's server to open this database.|
Messagebox twoLiner, MB_ICONINFORMATION, "You are not connected to the server."
End If
End Sub