OnNextRecord Problem

I’m am trying create a view that only shows the records with the first occurance of a value in a particular field. I put the following code in the OnNextRecord trigger: CurrValue := “Source No.”; REPEAT ResultSteps := NEXT(Steps); UNTIL (ResultSteps =0) OR (“Source No.” <> CurrSourceNo); EXIT(ResultSteps); This achieves exactly what I want however in use I get an inconsistent ‘Do you want to rename the record?’ error. The form is non-editable. Any suggestions greatly appreciated.

Gary, If you don’t get any suggestions for your current problem I did something similar to this by populating a temp table with a subset of records from a real table (in your case the first instance records only) then running the form on the temp table. Please reply if you want me to flesh this out a bit. Regards, Chris.

Thanks Chris, I was rapidly coming to the conclusion that a temporary table was the only way around this anyhow. This one is just frustrating me as I can’t work out why I am getting the problem and the approach appeared to be quite an elegant solution. Regards Gary

Why not just search the forum, I have previously posted a solution to this. Go to search, and use “OnNextRecord” and something like “skip” or “show” you will find your solution [;)] http://www.navision.net/forum/topic.asp?TOPIC_ID=6603&SearchTerms=OnNextRecord

I think what problem is: 1. When form opens, it get’s current record - OnNextRecord not executed 2. On OnNextRecord execution current rec not matched criteria and changed by another rec. 3. Now form still have old current rec, but OnNextRecord overwriten it by another rec. Form understands it like rename. To achieve that, you must use OnFindRecord and OnOpenForm trigers too.