InViewEdit Event and VALIDATE REQUEST

I got the following code from designer help. After the Msgbox shows the validate message in a document’s column edition, Notes shows another Msgbox with this message:“Error validating column value”

How can I avoid this second message?

Case VALIDATE_REQUEST

Select Case Colprogname(0)

    Case "Who"

    If Fulltrim(Columnvalue(0)) = "" Then

    Messagebox "You must enter a Name",, "No value in column"

     Continue = False

End If

Case Else

    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

Subject: re: InViewEdit Event and VALIDATE REQUEST

It’s a shame that you cant supress the default error message. If you use the workaround presented in another response to this thread the user loses the value entered and the focus of the column (this is not a critique of the workaround).

So the ability yo supress the deafult error message is on my wishlist!

Subject: RE: re: InViewEdit Event and VALIDATE REQUEST

Declare a Global Variable (giSave)

Instead of Continue = false in your VALIDATE_REQUEST, set giSave = false.

In the SAVE_REQUEST only save if giSave = True.

Subject: InViewEdit Event and VALIDATE REQUEST

David,Not sure but I believe the problem is setting Continue = False in the VALIDATE_REQUEST case. So I came up with the following workaround. Hope it helps:

Sub Inviewedit(Source As Notesuiview, Requesttype As Integer, Colprogname As Variant, Columnvalue As Variant,

Continue As Variant)

Const QUERY_REQUEST = 1

Const VALIDATE_REQUEST = 2

Const SAVE_REQUEST = 3

Const NEWENTRY_REQUEST = 4 Const COLUMN_FEATURE = “Company”

Const FIELD_FEATURE = “Company”

Static flag As Integer

Dim ws As New NotesUIWorkspace

Dim note As NotesDocument

Dim db As NotesDatabase

Set db = ws.CurrentDatabase.Database

If (Source.CaretNoteID = “0”) Then Exit Sub

Set note = db.GetDocumentByID(Source.CaretNoteID)

If (note Is Nothing) Then Exit Sub

If (RequestType = QUERY_REQUEST) Then

If(note.HasItem(FIELD_FEATURE)) Then

Columnvalue(0) = note.GetItemValue(FIELD_FEATURE)

Else

Continue = False

End If

Elseif (RequestType = VALIDATE_REQUEST) Then

If ColumnValue(0) = “IBM” Then

Msgbox “Wrong! GO BACK!”

Columnvalue(0) = note.GetItemValue(FIELD_FEATURE)

flag = 1

Exit Sub

Else

flag = 0

Continue = True

End If

Elseif (RequestType = SAVE_REQUEST) Then

If flag = 1 Then

Exit Sub

Else

Call note.ReplaceItemValue (FIELD_FEATURE, ColumnValue(0)) 'assumes that value stored in

ColumnValue(0) is the value that goes with that column.

Call note.Save(True, True, True)

End If

End If

End Sub

HTH,

Rick Hinze