IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Technical Library
developerWorks


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

Tip submitted by
Anthony Vanlerberghe


Level: Advanced
Works with: All
Platform: Windows
Updated: 01/02/2002

Related link:
More Tips from Notes.net

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)
    Dim doc As NotesDocument
    Set doc = Source.Document
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)
    Dim doc As NotesDocument
    Set doc = Source.Document
    Dim createDate As Variant
    createDate = doc.Created
    Messagebox (createdate)
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


Would you like to submit a tip?
    About IBM Privacy Contact