Composing document and setting field value

On the action button below script is written to execute when form is compose and set Group field to “GI” value. I am getting error message “notes error: you must be in edit mode to change value of a field”. The form opens in edit mode automatically. Why am I getting this error? I have same code in other db which works fine.

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = workspace.ComposeDocument( "", "","SGEAAEntry" )

Call uidoc.fieldsettext("Group","GI")

Call uidoc.refresh

Please advise

amp

Subject: maybe this is your problem (from HELP)

If the ComposeDocument method is used in a view action, the form formula of the view overrides the form specified in the method. To avoid this problem, add the following line to the form formula:@If(@IsNewDoc; @Return(Form); “”);

Subject: form formula

this didn’t work.