Field not updated

i have the following code, it is a action button to delegate the paysheet to assistant. but some of my user got a problem that when they click on the button, edit history updated, but the “PayRC_Assist” field still empty, have not updated to delegated assistant’s name.i have to request user to delegate again, working fine.

what is the root cause of this problem? it only occurs on 2,3 users, not all users.

Any help will be greately appreciated!

Sub Click(Source As Button)

Dim session As New NotesSession

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim db As NotesDatabase

Dim collection As NotesDocumentCollection

Dim doccol As NotesDocumentCollection

Dim doc, newdoc,maildoc As NotesDocument

Dim view As notesview

Dim uname As New NotesName(session.UserName)

Dim Assistant_name As NotesName

Dim rtitem As NotesRichTextItem

Dim item As notesitem

On Error Goto errorhandle

Set db = session.CurrentDatabase

Set uidoc = workspace.CurrentDocument

Set doc=uidoc.Document

'Standardise date format

Dim svrDate As String

Dim createDate As String

Dim dd As String, mm As String, yyyy As String

Dim tm As String

createDate = Format$(timedoc.Created, “dd/mm/yyyy”)

dd = Cstr(Left(createDate, 2))

mm = Cstr(Mid(createDate, 4,2))

yyyy = Cstr(Mid(createDate, 7, 4))

tm = Cstr( Timevalue ( timedoc.Created ) )

svrDate = dd & “/” & mm & “/” & yyyy & " " & tm

'end

'Get the name from address list

as_name = workspace.PickListStrings(PICKLIST_NAMES, False, “”,“PayRCView”, “View”, “Select”, 1)

Set Assistant_Name=session.CreateName(as_name(0))

If Assistant_Name.OrgUnit1 <> “MOE” Then

Messagebox “This email address does not belong to MOE. Please select another email address.”,48,“Error”

Exit Sub

End If

answer=Messagebox (“Please confirm delegation to “+Assistant_Name.Abbreviated+”.”,4+48, “Confirmation”)

If answer<>6 Then

	Exit Sub		

Else

‘Update the current paysheet with the Assistant PayRC Heads’ name

	doc.PayRC_Assist=Assistant_name.Abbreviated

Call doc.save(True,True)

	

	

'Amendment Update History log

Set item = doc.GetFirstItem( "EditHistory" )



temp="Delegated by " + Cstr(uname.Abbreviated) + " to " + Cstr(Assistant_name.Abbreviated) + " on " + svrDate

Call item.AppendToTextList( temp )

Call doc.Save (True, False)

'Send email to inform Assistant PayRC

Set mailDoc = New NotesDocument( db )

Set rtitem = New NotesRichTextItem( mailDoc, "Body" )

Call rtitem.AppendDocLink( doc, db.Title )

Call rtitem.AddTab( 1 )

Call rtitem.AppendText( "- Paysheet for "& Format(doc.Paysheet_Month(0),"mmmm") )

Call rtitem.AddNewLine( 1 )		

Call rtitem.AddNewLine( 1 )

Call rtitem.AppendText("Please verify the above paysheet. ")

mailDoc.Subject = "Verification of Paysheet"

mailDoc.SendTo = Assistant_Name.Abbreviated

mailDoc.Send( False )      

	

Messagebox("This paysheet has been delegated to "+Assistant_Name.Abbreviated+"."+Chr(10) +_

"Assistant VO will only be able to access the database the following day." )

End If





Exit Sub

Errorhandle:

If Err()="184" Then

	Exit Sub

End If

Messagebox "Error" & Err() & ": " & Error()

Exit Sub

End Sub