Hi,
I have a doucment which when composed creates a drop down dynamically taking values from a column in a view from another database.
I also have another button next to this field which when clicked should take the value selected from the drop down and search another databse view for a document to match this value and then open it. But it doesnt work ..
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As notesuiworkspace
Dim db As NotesDatabase
Dim view As NotesView
Dim uidoc As notesuidocument
Dim doc As NotesDocument
Dim product As String
Set db = New NotesDatabase( "server", "prductlist.nsf" )
Messagebox db.filename
Messagebox db.IsOpen (it returns falsoe here )
Set view = db.GetView( "prodbydesign" )
Messagebox view.Name ( Again error saying that database is not open)
Set uidoc = workspace.CurrentDocument
product = uidoc.FieldGetText( "odesref" )
Set doc = view.GetDocumentByKey(product)
Call workspace.editdocument(False,doc)
End Sub
I NASICALLY JUST NEED THIS DOCUMENT TO OPEN WHEN USERS NEED TO SEE THE DOCUMENT..I DONT MIND OPENING IT IN EDIT MODE BUT WOULD PREFER TO OPEN IT IN NON-EDIT MODE
Software/Hardware used:
ASKED:
January 15, 2007 11:41 AM
UPDATED:
January 16, 2007 4:41 PM
I use a technique in one of my scripts to open the names.nsf database. You’d of course use whatever server name is appropriate.
Dim namesDb As NotesDatabase
Set session = New NotesSession
If session.IsOnServer Then
ms = “”
Else
ms = “Server1″
End If
Set namesDb = session.GetDatabase(ms,”names.nsf”)
Otherwise you can try using a database open method once you’ve identified db.
Call db.Open( “”, “” )
I’ve often found it works best to open a database in this manner:
Set db = New NotesDatabase( “”, “” )
Call db.Open( “server”, “prductlist.nsf” )
You have not opened the database is your script. You need to replace “Set db = New NotesDatabase( “server”, “prductlist.nsf” )” with “Call db.Open( “server”, “prductlist.nsf” )”
HTH
Guys,
In my experience, using the New method of the NotesDatabase object opens it for you. From Help for the New method:
Set notesDatabase = New NotesDatabase( server$, dbfile$ )
Parameters
server$
String. The name of the server on which the database resides. Use an empty string (“”) to indicate a database on the current computer: if the script runs on the workstation, the empty string indicates a local database; if the script runs on a server, it indicates a database on that server.
dbfile$
String. The path and file name of the database within the Notes or Domino data directory. Use empty strings for both dbfile$ and server$ if you want to open the database later. Use a full path name if the database is not within the Notes data directory.
Return value
notesDatabase
A NotesDatabase object that can be used to access the database you’ve specified.
If a database exists at the server$ and dbfile$ specified, the NotesDatabase object is open, and the script can access all its properties and methods.
Sorry, that last post was a bit negative. The error must be in the line ‘Set db = New NotesDatabase( “server”, “prductlist.nsf” )’
The server name should be in abbreviated form – eg “MyServer/MyOrg” and the filename in your example – “prductlist.nsf” should exist in the Notes data directory of that server.