Getting information from a table

I have a table/form that I need to construct a button for that gets information from one table and populates field(s) in another. Details: I have a new table and form linked to the Service Item table and I want to have details from the Service Item table populate certain fields in this new table when a use ‘clicks’ on a button. These fields must coorspond to the correct Service Item No. already in this new table. The reason why I don’t want to automatic this is that these fields are only populated at a certain time. Any ideas? Are there any examples of something like this already in Navision? Thanks.

ONPUSH var mynewTablerecord : record NewTable; begin if (“service item No.” <>’’) THEN BEGIN CLEAR (mynewtablerecord); mynewtablerecord.RESET; mynewtablerecord.SETRANGE(“Service item no.”,“service item no.”); IF (NOT myNewTableRecord.FIND(’-’)) THEN BEGIN mynewtablerecord.SETRANGE(“Service item no.”); mynewtablerecord.INIT(TRUE); mynewtablerecord.VALIDATE(“Service item no.”,“service item no.”); mynewtablerecord.INSERT(TRUE); END; mynewtablerecord.Myfield1 := field1; mynewtablerecord.Myfield2 := field2; mynewtablerecord.Myfield3 := field3; myNewtablerecord.VALIDATE(myfield4,field4); myNewtablerecord.VALIDATE(Myfield5,field5); mynewtablerecord.MODIFY(TRUE); END; end;