LDD Today


Tips from Notes.net
Getting a handle on an unsaved document's properties

Tip submitted by
Anthony Vanlerberghe

Level: Advanced
Works with: All
Updated: 02-Jan-2002


We all know that until a new document is saved, it—and its document properties—exist only in memory. But with some applications, it is handy to be able to manipulate or use this document information before the user saves the document. With a little design work, you can get a handle on the document properties of a newly composed document—by declaring and setting the document in the Postopen event of the form being composed. Here's how.

First, create a "calling agent" with the following code. You might, for example, create a Create New Document action button in a view.

Dim ws As New NotesUIWorkspace
Dim newDoc As notesdocument
Dim newUIdoc As notesuidocument
Set newUIdoc = ws.composeDocument("","","newDoc")
Set newDoc = newUIdoc.document 'This will get handle on document to allow manipulation

Then, in the Postopen event in the document's form, add this:

Sub Postopen(Source As Notesuidocument) End Sub

This makes the document properties available through LotusScript, to be used as necessary for the application. You can pull out whatever information you need, such as the creation date, field names, UNID, and so on. For example, the following variation pops up a message box with the new document's creation date:

Sub Postopen(Source As Notesuidocument) End Sub


SUBMIT YOUR TIPS!
We encourage you to send us your tips (You can also click the "Would you like to submit a tip?" graphic below.) Your tips can be anything you've discovered about Notes, Domino, Designer, or the Domino Administrator that you think is interesting, useful, or handy. For ideas, take a look at our tip archives. If we publish your tip, we'll send you your very own Notes.net mug (shown below).
Notes.net mug