Hi
Is it possible to prevent users from renaming records in certain forms ?
I know some people will ask what reason, and some people will tell me just to throw an error message in the rename trigger of the underlying table.
The reason for doing so is that it should be a master table renaming tables where the primary key of the master table is a foreign key.
The application is integrated with a webshop, and the webshop handles the renaming of master tables, so I should only care about renaming the tables and not telling the webshop what to do(only that the master table has been renamed - in that way I don't need to put a lot of code in the rename triggers of other than master tables)
0
Comments
no the key doesn't use number series. You have to be able to insert new records in the table and define the primary keys yourself, so I don't think that's the way to go :-)
IF(Category <> '') THEN
BEGIN
CurrForm.Category.EDITABLE := FALSE;
END
OnAfterGetCurrRecord trigger, but it worked a little bit too well...I can't edit the field no matter I make a new record. Am I missing your point in someway ?
CurrForm."No.".EDITABLE ("No." = '')
assuming that the Field "No." is the primary key field.
The editable property of the field on the form is true.
FD Consulting
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
As the form opens usually to an existing record your line of code comes in and makes the field not editable. When you press F3 nothing happens because you have not programmed it and the property is not applied again as the form is already open.
FD Consulting
Not true at all. They are applied when a new record is loaded. What if you loaded a record that caused fields to be uneditable, but then moved to another perfectly good record without closing the form? You wouldn't expect the fields to remain uneditable.
My Blog - nav.education
Actually this thread supports my theory: You have to program both, the editable=true and the editabe=false part. If you set the property to true and only program the false part it is not working.
FD Consulting