Today I 'discovered' a nice litte trick. Thought I'd share it with you.
It was necessary to have an editable field on a non-editable form.
In the OnAfterGetCurrRecord on the form there is the following code:
CurrForm.EDITABLE(status = status::open);
So if status is released the form is non-editable.
But 1 field still has to be editable...
In the OnActivate of the field I put:
CurrForm.EDITABLE(TRUE);
In the OnDeActivate of the field I put:
CurrForm.EDITABLE(status = status::open);
Simple. But effictive.
Comments
I used it on a Card- and Subform. So List-form will work too.
Tino Ruijs
Microsoft Dynamics NAV specialist
Then I see the post and guess what a week later it's needed.
Thanks.
http://www.BiloBeauty.com
http://www.autismspeaks.org
Problem with activate and de-activate events in NAV, they get triggered when you don't expect it.
OnActivate()
CurrForm.EDITABLE(TRUE);
OnDeactivate()
CurrForm.EDITABLE(FALSE);
http://www.BiloBeauty.com
http://www.autismspeaks.org
That's right!
8)
Tino Ruijs
Microsoft Dynamics NAV specialist
Sometimes i get an error message "<table name> cannot be changed in this form" while using it.
Maybe there's something else i've got wrong, just pointing it out...
Probably you're changing the current record through code and you'll need a CurrForm.UPDATE when you return on the form.
Tino Ruijs
Microsoft Dynamics NAV specialist
for example,you need the item list to be non-editabl else people can be changing things by accident. but if you wanted to be able to change the blocked field only in the list then you might use such a code.
http://www.BiloBeauty.com
http://www.autismspeaks.org
Pranav
Pranav Joshi
MS Dynamics NAV Consultant
SBS Group Desert Mountain (Formerly Silverware Inc.)