Error Message - The control xxx cannot be edited, because underlying database field cannot be edited

I was trying to lock all the fields in Transfer Order that has been approved.

I created one boolean field to control this function. Once this field was checked by Supervisor, then, all the fields will be locked from any updatings.

I got an error saying that : The control…cannot be edited, because underlying database field cannot be edited.

Please help.

==========================================

OnValidate and OnAfterGetCurrRecord() I put the following code:

IF “Completed ?” THEN BEGIN
CurrForm.“Port of Origin/Lading”.EDITABLE := FALSE;
CurrForm.“Country of Origin”.EDITABLE := FALSE;
CurrForm.Commodity.EDITABLE := FALSE;
CurrForm.“Carrier Name”.EDITABLE := FALSE;
…etc
END ELSE BEGIN
CurrForm.“Port of Origin/Lading”.EDITABLE := TRUE;
CurrForm.“Country of Origin”.EDITABLE := TRUE;
CurrForm.Commodity.EDITABLE := TRUE;
CurrForm.“Carrier Name”.EDITABLE := TRUE;
…etc
END;

Here is a slightly different solution, that doesn’t require programing.

on the transfer order form that your users use, remove the menu item - Functions → Reopen.

your users can release the order, but not reopen it. this will accomplish the same thing,

You can make a copy of the transfer form and not hide the menu item → functions → reopen and give access to this form to the users that would be allowed to reopen the transfer.

Thank you David but for our business situation, we can’t use that function.

ZEN

Are you putting this code in the form?

Does the error occur when you change the “Completed” field value.

You might want to Create a function in the form “ActivateFields” Look at the Customer Card where it activates/deactivates the Contact Name field based upon the value of the “Primary Contact Name”.

Call your function in the OnOpenForm and OnAfterGetCurrentRecord and the Completed field’s OnDeactivate triggers. Do not enter the call in the OnValidate trigger for the Completed field.

John,

It’s YES for both questions.

I tried your advise but I still receive the error message. Please help whether I did something wrong.

====================================

This is what I did:

  1. In ActivateFields function I put:

CurrForm.“Port of Origin/Lading”.EDITABLE(“Completed ?” = FALSE);
CurrForm.“Country of Origin”.EDITABLE(“Completed ?” = FALSE);
CurrForm.Commodity.EDITABLE(“Completed ?” = FALSE);
CurrForm.“Carrier Name”.EDITABLE(“Completed ?” = FALSE);
…etc

  1. Calls the function in the OnOpenForm and OnAfterGetCurrentRecord and the Completed field’s OnDeactivate triggers.

Thanks

ZEN

Sorry that I have to ask so many questions, but sometimes hard to visualize.

Are the fields you are trying to control in the transfer header or line?

Are you sure there is no code in the onvalidate trigger of the Completed field on the form or in the table?

Would you do me a favor and change the field name from “Completed ?” to just "Completed’, leave out the question mark and try it again. You can change the fields caption in the table to include the question mark.

Let me know what happens.

John,

Your questions are logically understandable.

On Transfer Header.

Yes, there is no codes on both; trigger and table.

I did change the field name and I am still having the same error message.

Please advise.

ZEN [:)]

Which control? Any of the controls you are trying to change or just one?
Are you sure that among them there isn’t one which editable property is set to No on the table?

That’s it.

I didn’t expect by setting editable property to NO was the causing of my headache for these past 3 days. [:$]

Thank you Anna.

===============

John,

FYI. Once I changed the editable property to YES, everything is working fine.

Thanks,

ZEN

Zen, thanks for giving feedback, it’s always appreciated. I am sure Anna appreciates it. [:D]

And if I could ask you one more favour. When you get a resolution to a question, please give the post a star rating, which shows how good the solution was (in this case 5*) and also mark the topic as RESOLVED (you can find thread status at the top of the thread as per the attached picture), so other users know that the thread contains a solution.

Thanks.

David,

I did resolution feedback. Please direct me on how to post the star rating.

ZEN

Excelent thanks…

If you look at the top of your first post, you will see five grey stars. You can click on one of them, and that will give the star rating.
stars.jpg

Thanks David.

Definately will do.

ZEN