Button will not work in script

Hi all,I have written a code for lock the document.here i am also capturing history off the person who make different change.i have a field cappture the stastus.it will work properly.my code is here…

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim history As String

Dim history1 As String

Dim answer As Integer



Set uidoc = ws.CurrentDocument

answer = Msgbox("Are sure, that you want to lock this document for further editing",4+32,"International Certification Library")

If answer = 6 Then

	history1 = "Document has been locked by " & session.CommonUserName & " on " & Now &""

	If uidoc.IsNewDoc Or uidoc.EditMode Then

		history = uidoc.FieldGetText("History")

		If uidoc.FieldGetText("ProjectNo") = "" Then

			Msgbox "Project Numer must be entered before lock this document"

			Exit Sub

		End If

		If uidoc.FieldGetText("DocStatus") = "Locked" Then

			Msgbox "The document was already locked"

			Exit Sub

		End If

		Call uidoc.FieldSetText("DocStatus","Locked")

		Call uidoc.FieldAppendText("History",Chr(13) + history1)

		Call uidoc.Refresh

		Call uidoc.Save

		Call uidoc.close

	Else

		If Not uidoc.EditMode Then

			Set doc = uidoc.Document

			doc.History = doc.History(0) + Chr(13) + history1

			doc.DocStatus = "Locked"

			Call doc.save(True,False)

			Call uidoc.close

		End If

	End If

End If

but when i want to unloock the doc with another button it not work.Pls advise where i make change.

my defult status is “0”.

and its code is here

Set uidoc = ws.CurrentDocument

answer = Msgbox("Are sure, that you want to unlock this document for further editing",4+32,"International Certification Library")

If answer =1 Then

	history1 = "Document has been locked by " & session.CommonUserName & " on " & Now &""

	If uidoc.IsNewDoc Or uidoc.EditMode Then

		history = uidoc.FieldGetText("History")

		'If uidoc.FieldGetText("ProjectNo") = "" Then

			'Msgbox "Project Numer must be entered before lock this document"

			'Exit Sub

		'End If

		If uidoc.FieldGetText("DocStatus") = "Locked" Then

			Call uidoc.FieldSetText("DocStatus","0")

		End If

			'Msgbox "The document was already locked"

			'Exit Sub

		'End If

		Call uidoc.FieldSetText("DocStatus","0")

		Call uidoc.FieldAppendText("History",Chr(13) + history1)

		Call uidoc.Refresh

		Call uidoc.Save

		Call uidoc.close

	Else

		If Not uidoc.EditMode Then

			Set doc = uidoc.Document

			doc.History = doc.History(0) + Chr(13) + history1

			doc.DocStatus = "0"

			Call doc.save(True,False)

			Call uidoc.close

		End If

Sorry for such long mail.

pls help me.