Multivalue Field/Front End "Contains"

I have a subroutine in the query save event that counts among other thing Vacation Days. My problem is that the field “Code” where the user indicates Vacation Day or Sick Day or other is a multivalue field by design.

When the user enters VAC for vacation my count worrk but when they enter VAC and Asked Off together my count doesn’t pick either up.

I need some sort of “contains” but I can’t figure out how this is done.

Any ideas?

example code

'vacation count

If code_1 = "VAC" Then

	x = x +1 

End If



If code_2 = "VAC" Then

	x = x +1 

End If



If code_3 = "VAC" Then

	x = x +1 

End If



If code_4 = "VAC" Then

	x = x +1 

End If



If code_5 = "VAC" Then

	x = x +1 

End If



If code_6 = "VAC" Then

	x = x +1 

End If



If code_7 = "VAC" Then

	x = x +1 

End If

Call cdoc.fieldsettext(“TotalVacation”, Cstr(x))

Subject: Multivalue Field/Front End “Contains”

Use the Contains method of the Notesitem class.

Dim itm as NotesItem

Dim uidoc as NotesUIDocument

Dim bedoc as NotesDocument

Dim ws as New NotesUIWorkspace

Set uidoc = ws.CurrentDocument

Set bedoc = uidoc.Document

Set itm = bedoc.GetFirstItem(“Code”)

If Not itm is Nothing then

If itm.Contains(“VAC”) then

x = x  + 1

End If

End If

Subject: RE: Multivalue Field/Front End “Contains”

Thanks Dave it worked like a charm. I modified it a little to count up the full week’s worth of codes.

For i = 1 To 7

	Set itm = bedoc.GetFirstItem("Code_" + i)

	If Not itm Is Nothing Then

		If itm.Contains("VAC") Then

			x = x + 1

		End If

	End If

Next i

Call uidoc.fieldsettext(“TotalVacation”, Cstr(x))