Create a New Document by Double-Clicking on a Calendar Date
The RegionDoubleClick event for a view can be used to trigger the creation of a new document. When a user double-clicks on a calendar date, a new document is created, and the date field is automatically populated with the selected calendar date.
How It Works
When the user clicks on a calendar date, the current date is retrieved. Then a new document is created, the appropriate field on the form is populated, and the form is displayed to the user. Be sure that the field used to generate the calendar view is also the field on the form that is populated with the calendar date.
Implementation
Create a calendar view and insert the following LotusScript code in the Regiondoubleclick event in the Programmer's pane. Be sure to replace FORM and FIELD with actual design element names. If other fields on the form need to be present, insert the additional statements before calling the "EditDocument" statement.
Sub Regiondoubleclick(Source As Notesuiview)
'------------------------------------------------------- ' Define the objects '------------------------------------------------------- Dim s As NotesSession Dim db As NotesDatabase Dim doc As NotesDocument Dim uidoc As NotesUIDocument Set ws = New NotesUIWorkspace Set s = New NotesSession Set db = s.CurrentDatabase Dim newdoc As New NotesDocument(db) '------------------------------------------------------- ' Set the form name and date field ' Replace FORM with a valid form name ' Replace FIELD with a valid date field name '------------------------------------------------------- newdoc.form = "FORM" newdoc.FIELD = Source.CalendarDateTime REM set other default field values here (as needed) '------------------------------------------------------- ' Create document '------------------------------------------------------- Set uidoc = ws.EditDocument (True, newdoc) End Sub