I am new to V6 and I want to allow the editing of documents in a view using Inviewedit.
I have three number columns that I would like editited and I have updated the column property ‘Editable Column’ in each.
I have copied one of the Inviewedit examples from Designer help and have adjusted it accordingly.
When testing the view, the column fields go into edit mode. I can update the column values but I don’t know how to save the value. If I press enter or the tab key, the value disappears and is not saved.
I have searched the forum for help but could not locate an answer to this problem.
Any help would be greatly appreciated.
Kind Regards
Louise
My Inviewedit code:
Sub Inviewedit(Source As Notesuiview, Requesttype As Integer, Colprogname As Variant, Columnvalue As Variant, Continue As Variant)
%REM
This view has two editable columns: one Text and one Numeric.
The programmatic name of each editable column
is the same as the name of the field whose value it holds,
but the processing for each column is different.
%END REM
REM Define constants for request types
Const QUERY_REQUEST = 1
Const VALIDATE_REQUEST = 2
Const SAVE_REQUEST = 3
REM Define variables
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim caret As String
REM Get the CaretNoteID - exit if it does not point at a document
caret = Source.CaretNoteID
If caret = "0" Then Exit Sub
REM Get the current database and document
Set db = Source.View.Parent
Set doc = db.GetDocumentByID(caret)
REM Select the request type
Select Case Requesttype
Case QUERY_REQUEST
REM Reserved - do not use for Release 6.0
Case VALIDATE_REQUEST
REM Write message and cause validation error if …
Select Case Colprogname(0)
Case "FieldNumeric"
REM ... value in numeric column is non-numeric or negative
If Isnumeric(Columnvalue(0)) Then
If Cint(Columnvalue(0)) < 0 Then
Messagebox "Value must be greater than 0",, "Negative value"
Continue = False
End If
Else
Messagebox "Value must be numeric",, "Non-numeric value"
Continue = False
End If
End Select
Case SAVE_REQUEST
REM Write the edited column view entries back to the document
For i = 0 To Ubound(Colprogname) Step 1
Select Case Colprogname(i)
REM Write converted numeric entry back to document
Case "FieldNumeric"
Call doc.ReplaceItemValue(Colprogname(i), Cint(Columnvalue(i)))
End Select
Next
REM Save(force, createResponse, markRead)
Call doc.Save(True, True, True)
End Select
End Sub