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
"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.