Mark XY Brown 19.Aug.09 01:21 PM a Web browser Applications Development 6.0.3 Windows XP
I've set up a database for users to make service requests - it's something of a work in progress.
The current changes involve calendar views. I've set it up so that existing requests can be dragged and dropped into new dates and, subject to some checking, the document gets the new request date added to it. I'd like to enable the users to double-click on a day within the calendar and have a new request appear, with the selected date in the relevant field. The code that I have so far is:
Sub Regiondoubleclick(Source As Notesuiview)
'Create a new request if it's not in the past.
Dim datNew As NotesDateTime
Dim booCheck As Boolean
Dim nitNew As NotesItem
Set uiDb = ws.CurrentDatabase
Set db = uiDb.Database
Set doc = db.CreateDocument
doc.Form = "LoadRequests"
Set uiDoc = ws.EditDocument(True, doc, False, ,True, False)
Set datNew = New NotesDateTime(Source.CalendarDateTime)
Set nitNew = doc.ReplaceItemValue("LRReqDate", datNew.DateOnly)
If Not uiDoc.EditMode Then uiDoc.EditMode = True
booCheck = ViewValidate(datNew, doc, 1)
If Not booCheck Then
doc.SaveOptions = 0
Set doc = Nothing
Set uiDoc = Nothing
(ViewValidate is a function that compares dates and times in the document with values from other documents and either allows or rejects the change.)
When I step through the code, it falls over at "If Not uiDoc.EditMode..." If I comment that line out and run it, it falls over at the next line. I've seen posts in this forum about a known issue using uiDoc.EditMode to set a UIDoc to Read mode, but I haven't seen anything about what I'm trying to do - set it to Edit mode. Does anyone have any ideas?
Also, does anyone know why, when the argument in the EditDocument method clearly states that the UIDoc should be in Edit mode, the EditMode property gets set to False?