I have problems when filtering the records shown in Table Box control on a form. When I use Rec.Setfilter or filter the records elsewhere beside the Rec variable, the records on the Table Box changes, But when I click on the Table Box which shows filtered records, an “Are you Sure to Rename the Record?” dialog appears. I also use Find(’-’) and UpdateControls function after filtering, but no use! How can I avoid this message, and do the filtering in a more healty way? Thanks for help . . .
Maybe CurrForm.UPDATE(FALSE) can help you?
No, no use
It could be one of many things. Do you pass rec to any other process such as a codeunit? Is it called via a particular form trigger? I actually tried recreating your sample but did not have any problems. I prefer to steer clear of Rec when working with forms by doing the following: TableVar.COPY(Rec); TableVar.SETRANGE(“No.”,‘ABC001’); Rec.COPY(TableVar); Hope this helps! [:D] Regards, edd
I filter Rec from an OnLookup trigger of a textbox, It doesnt happen till you click on the table view, after clicking the table view, the “Are you sure to rename the record” message appears. The Copy Function doesnt help too. I get the same message even I tried to construct another, simpler form . . .
Can you post C/Al code - it would be easier identify the problem…
Ok, let me give it : This is a simple example that raises the same error : Form uses Post Code table, i run it on the cronus example database, there is a text box above which user enters the first digits to filter the Code field, and a table box below which show records, the code in the OnValidate trigger of text box is just this : Rec.SetFilter(“Code”, textCode+’*’); Rec.Find(’-’); When user enter the expression, true records shown on the form, but when user clicks on the table view, But 1. When the user clicks on the table view, on any record ONCE, 2. then reenters the expression to filter the records, 3. then click on the table view again, it raises “Are you sure to rename the record” Message, which is unwanted. Disabling the Table view, making it non editable, changing form’ s SourceTablePlacement property, or filtering the Rec on another variablethen assigning it to Rec, using CurrForm.UpdateControls or CurrForm.Update(false) all have no use. Thank for your feedback, it is very urgent and i know no way to fix it. Thanks.
You don’t need the Rec.FIND(’-’)
Use a CurrForm.UPDATE instead
If I dont use Rec.Find(’-’) then the record which tablebox cursor points, reappears in the filtered records although it is not within the filter, until you scroll up and down to make it disappear.
Like I said, you need to use CurrForm.UPDATE
Thanks, CurrForm.Update (Not Update(false) because it fails too) helped the problem, but now i cannot get the table pointer on the first record automatically, i actually need this. . .
Therefore you need a subform instead of a tablebox and then use the code CurrForm..ACTIVATE
Try this: SETFILTER(Code, textCode+’*’); CurrForm.UPDATE(TRUE); FIND(’-’); CurrForm.UPDATE(FALSE); P.S. I tried your example using only CurrForm.UPDATE(FALSE), but I couldn’t get the error…