?
Solved

I have a lotus script question ...

Posted on 2003-02-24
6
Medium Priority
?
241 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

765 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