I’m trying to put field validation in QuerySave.
I have a checkbox that has multiple values. If a certain value in the multiple list is chosen but another field (fieldB) is not filled in, I want to stop the doc from saving and give the user a prompt.
I want to get away from putting field validation on every field in formula language. I can put field validation in LS but this one is tripping me up. Much thanks for any help…!
Here is what I have:
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim tmp1 As Variant
tmp1 = Evaluate({@Contains(fruit; "apple")},Source)
If (tmp1(0) = 1) Then
Messagebox ("Please enter fieldB.")
Call source.gotofield("fieldB")
Continue = False
Exit Sub
End If
Subject: problem using evaluate in QuerySave
You didn’t say what the error is, so here are a couple of thoughts:
Possible quick fix #1
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim tmp1 As Variant
tmp1 = Evaluate({@Contains(fruit; "apple")},Source.document)
If (tmp1(0) = 1) Then
Messagebox ("Please enter fieldB.")
Call source.gotofield("fieldB")
Continue = False
Exit Sub
End If
End Sub
Approach number 2 without an evaluate
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim x as integer
For x=0 to ubound( Source.Document.fruit)
if lcase(Source.Document.Fruit(x)) = "apple" then
Messagebox ("Please enter fieldB.")
Call source.gotofield("fieldB")
Continue = False
Exit Sub
End if
Next
End Sub
Subject: RE: problem using evaluate in QuerySave
Thanks Stephen…
Ahhhh…it was the Source.document! It’w working…
ps…Sorry, I forgot on my original post. I was getting a weird error… Lotus Notes…“Operation Failed”.
Thanks!