"Variant does not contain an object" Problem

Hi All,Function GoApprove(Doc As NotesDocument, UserName As String, Status As String) As Boolean

Dim Category As NotesItem



Msgbox Status

Select Case Status

	

Case "Awaiting CalSTRS Real Estate First Approval"                               

	

	Set Category = Doc.GetFirstItem("Category_1")		

	Forall x In Doc.Apptype		

		If  Catergory.Contains(x)	Then 

			

		'There is one more type user need to approve so we will update the Audit Log and exit				

			GoApprove=False	

			Exit  Function

		End If

		

	End Forall

	GoApprove=True

	

Case "Awaiting CalSTRS Real Estate Second Approval"   

	

	Set Category = Doc.GetFirstItem("Category_2")		

	Forall x In Doc.Apptype		

		If Not Catergory.Contains(x)	Then 				

			GoApprove=False	

			Exit  Function

		End If			

	End Forall

	GoApprove=True

when i am debugging above code i got error “variant does not contain an object” at if not Category.Contains(x) then line,

i am taking Category variable as a notesitem, we can use contains method on notesitem.i am not using any variant variable here. but i am getting this error. if anyone knows please help me.

thanks,

Prasad

Subject: “Variant does not contain an object” Problem

It might be what Rob suggested, but this

If Catergory.Contains(x) Then

will fail because you wrote CateRgory instead of category.

Use “Option Declare” for all your desing elements. With this enabled you will not be able to save your design element because the designer will see that Catergory variable is not declared.

Hope this helps

Renaud

P.S. I just saw you did the same with the field “Category_2”. Probably a copy/paste… :wink:

Subject: “Variant does not contain an object” Problem

To me it sounds like there is no Category_1 item in your doc present.

Subject: “Variant does not contain an object” Problem

Hi Rob Goudvis,Renaud,It’s working fine. i got it.

thanks for your help

Thanks,

Prasad