Hi
Please could you give us some tips on how to the following:
We need to open a document using a form in a different database, does anyone have any idea on how to do this.
Many thanks.
Coll
Hi
Please could you give us some tips on how to the following:
We need to open a document using a form in a different database, does anyone have any idea on how to do this.
Many thanks.
Coll
Subject: Opening a document using a form in another db
You can’t open a document in database A using a form from database B. But you can create a new document in database B – never save it, so it only exists in memory. Use CopyAllItems to get the field information from the original document, and use NotesUIWorkspace.EditDocument to display it.
If you need to let the user edit it, you’ll have to use the Querysave event to scan for differences and copy them back to the original document.
Or, to make it easy ou yourself, you could just copy the form to the database that contains your documents.
Subject: Opening a document using a form in another db
Perhaps you have to copy the form in the other db;if you cannot (you don’t have designer access)
you could perhaps send the form (checking the property “include form when mailed”)
bye
Pietro
Subject: Opening a document using a form in another db
Maybe this will help!
Get Values from ANOTHER DATABASE
Dim session As New notessession
'Dim db As notesdatabase
Dim db As New notesdatabase("", "DB1.nsf")
Dim view As notesview
Dim doc As notesdocument
Dim itemA As notesitem
Dim itemB As notesitem
This script opens another database, gets field values and then copies to fields in current database.
'Set db = session.currentdatabase
'Set db2 = New notesdatabase("", "DB1.nsf")
Set view = db.getview("All")
Set doc = view.getfirstdocument
Set itemA = doc.getfirstitem("fieldone")
Set itemB = doc.getfirstitem("fieldtwo")
Dim db2 As New notesdatabase("", "DB2.nsf")
Set doc2 = New notesdocument(db2)
Call itemA.copyitemtodocument(doc2,"fieldone")
Call itemB.copyitemtodocument(doc2, "fieldtwo")
Call doc2.save(True, False)
'While Not(doc Is Nothing)
' Messagebox "Field One Value: " & doc.fieldone(0)
' Messagebox "Field Two Value: " & doc.fieldtwo(0)
'Set doc = view.getnextdocument(doc)
'Wend
Subject: Opening a document using a form in another db
It is a very unusual thing to do. There is probably a better way to achieve what you want. If you explain in more detail why you want to do this, then someone might be able to suggest a simple solution.Anyway, if you really want to do it, here’s how…
Make a special form containing a Rich Text field. Use it to make a special document – it could be a profile, or it could be a document that you can find in a hidden view. In the Rich Text field, paste a database link that points to the other database where the form is. Save and close the special document.
In the documents that you want to open, make the Form item the name of the form in the other database. Use CopyItemToDocument to copy the $Links item from the special document, changing its name to $FormDatabaseID.
Notes automatically uses the link information to find the other database. Then Notes uses the form there to open the document.