?
Solved

I have a lotus script question ...

Posted on 2003-02-24
6
Medium Priority
?
244 Views
Last Modified: 2013-12-18
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","Bulletin 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
-----------------------------------------
0
Comment
Question by:SandraE
6 Comments
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 800 total points
ID: 8011281
Addition to your code

Dim discdb as NotesDatabase
If db.server="" Then
   set discdb = session.GetDatabase( "", "Dicussion.nsf")
if not discdb.IsOpen then
   Msgbox "You need to connect to your office's server to open this database"
end if
else
   set discdb = session.GetDatabase( db.Server, "Dicussion.nsf")

if not discdb.IsOpen then
   set discdb = session.GetDatabase( db.Server, "home\Dicussion.nsf")

if not discdb.IsOpen then
   Msgbox "Unable to open the discussion database"
end if

end if
end if

if discdb.IsOpen then Call workspace.OpenDatabase ( discdb.server, discdb.FilePath,"Bulletin Board\By Category",,False, False)



~Hemanth
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8012055
Hello Sandra,

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

0
 
LVL 5

Expert Comment

by:AndrewJayPollack
ID: 8012647
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



0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 63

Expert Comment

by:Zvonko
ID: 8012700
My proposal did the same :-)

I only added extra replica id to reduce the hassle by one more level.

0
 
LVL 1

Author Comment

by:SandraE
ID: 8012907
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
0
 
LVL 1

Author Comment

by:SandraE
ID: 8171583
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!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question