Problem with lotus script. Please help

I am encountering an error on debugging the code. It is an already done project, for which i have to add functionalities.The code is as follows…

I have typed ***** in the line giving me the error of “Type mismatch”.

Sub Postopen(Source As Notesuidocument)

Dim s As New notessession

Dim db As notesdatabase

Dim view As notesview

Dim doc As notesdocument

Dim item As notesitem



Set db = s.currentdatabase

Set view = db.getview("(autoorder)")

Set doc = view.getlastdocument



status = Source.fieldgettext("status")

If status = "Ready For Purchase by OFG" Then

	Messagebox "Order Moved to Purchase, Opening the order is not possible"

	continue = False

	Exit Sub

End If



If source.IsNewDoc Then

	If (doc Is Nothing) Then

		Call Source.fieldsettext("order_no",Cstr(BL0000))

	End If

	test =  doc.getitemvalue("order_no")

	*****test1 = Cint(Mid(test(0),3)  )+ 1*****

	If (Len(test1)) = 1 Then

		test1 = Mid(test(0),1,5) + Cstr(test1)

		Call Source.fieldsettext("order_no",test1)

		Call Source.gotofield("bregion")

	Elseif (Len(test1)) =2 Then

		test1 = Mid(test(0),1,4) + Cstr(test1)

		Call Source.fieldsettext("order_no",test1)

		Call Source.gotofield("bregion")

	Elseif (Len(test1)) =3 Then

		test1 = Mid(test(0),1,3) + Cstr(test1)

		Call Source.fieldsettext("order_no",test1)

		Call Source.gotofield("bregion")

	Elseif (Len(test1)) =4 Then

		test1 = Mid(test(0),1,2) + Cstr(test1)

		Call Source.fieldsettext("order_no",test1)

		Call Source.gotofield("bregion")

	Else

		Call Source.gotofield("bregion")

	End If

End If

End Sub

To avoid the error, should i be entering integer or characters into the field and the length of the entered value. Please help me…

Subject: Problem with lotus script. Please help…

It looks like you don’t have enough parameters on that MID