Dialog passing values

My code seems to work in a view but not from a form calling a dialog box. What am I doing wrong?

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim thisDb As NotesDatabase

Dim uidoc As NotesUIDocument

Dim thisDoc As NotesDocument

Dim dialogDoc As NotesDocument

Dim vblank As Variant

Dim continue As Variant



Set uidoc = ws.CurrentDocument

Set thisDb = session.CurrentDatabase

Set thisDoc = uidoc.Document

Set dialogDoc = thisDb.CreateDocument

dialogDoc.UserInput = thisDoc.FieldComment

continue = ws.Dialogbox("KeysDialog",True,True,False,False,False,False,"Allocate Access Card Number",dialogDoc,True,False,True)



vblank = dialogDoc.UserInput(0)



If vblank<>"" Then				'make sure input is not blank

	uidoc.EditMode=True

	

	Call thisDoc.ReplaceItemValue(FieldComment,dialogDoc.UserInput)

	'Call thisDoc.ReplaceItemValue(FieldUpdate,"See Comment")

	Call uidoc.GotoField(FieldComment)

	Call thisDoc.Save(True,True)

	Call uidoc.Refresh

End If

Subject: dialog passing values

Is your field FieldComment a richtext field? In that case it is not available before the document is saved.

Nb: Why are you using the extended format to retrieve a value form the document and the preferred method when restoring it?