Read mode & Edit mode Problem

Hi all,

I have some computed fields in the form. I need to refresh the fields to view the value of the field. How can i achieve it??

When i use source.Refresh in the post open getting an error “Document command not available”( since the document is opening in the read mode)

so i tried the code below

if Not Source.IsNewdoc then

source.Editmode = true

call source.Refresh

source.Editmode = False

End if

if i use the above code it goes in to a infinite loop changing from read mode to edit mode and vice versa… and it also prompts “Do u want to save changes?” every time the code reaches the source.EditMode = False

Can anybody help me out to fix this issue??

Thanks in advance

Subject: Read mode & Edit mode Problem

"it goes in to a infinite loop ". This is not due to your code in “PostOpen”. The code is fine there. Check the code in any of the form event which is making to refresh the document from elsewhere after you load it.

Create a “saveoptions” hidden editable text field and put the same fieldname as formula in the ‘Default’ field event.

Add this line:

Call Source.FieldSetText(“SaveOptions”, “0”)

after your line -----> Source.Refresh in the PostOpen form event. This will get rid of that Save Prompt which you are getting. Try it and post your comments.

Subject: Read mode & Edit mode Problem

Hi Joan,

Try enabling “Automatically refresh fields” on form properties. “Form Info” tab.

Best Regards,

Munish Kaushik

Subject: Much easier way…

Create a new formula agent with the following code:

@Command([ToolsRefreshSelectedDocs])

Select the documents you wish to refresh in the view and run the agent.

It will essentially so the same thing without having to open and edit each doc.

Subject: Read mode & Edit mode Problem

Try this caode, it will work out

If Not (Source.IsNewDoc) And Not ( source.EditMode) Then

	source.Editmode = True

	Call source.Refresh

	Call source.Save

	source.Editmode = False

End If

Subject: RE: Read mode & Edit mode Problem

Hi anitha thanks for ur reply. But its not working… any other suggestions???