Table lookup from form variable

We have two variable fields on a form “Pick Slip No.” and “Scan”. The user scans the barcode(pick slip no.)into the “scan” field We want the system to lookup and find the "pick slip No. in the table and place the record in the “Pick Slip No.” field on the form. While retaining focus on the “scan” field. We have tried several methods and we get the message “do you want to rename the record?” Thanks

I’m not sure I understand: Do the fields “Pick Slip No.” and “Scan” belong to the source table of the form or to an other table? What you must not do is to use the source-record (Variable “Rec”) directly for searching. Use a copy of the record instead:

locRec.SetRange (Scan, Scan);
if locrec.find ('-') then
  rec.get (locrec."pick slip no.");

------- With best regards from Switzerland Marcus Fabian

Also, if the field you are populating is part of the primary key, it is possible to get this message. Try setting the forms property DelayedInsert to Yes. Bill Benefiel Manager of Information Systems Overhead Door Company (317) 842-7444 ext 117

Here is the code: PickHeader.SETCURRENTKEY(“Pick Slip Ticket”); PickHeader.SETFILTER(“Pick Slip Ticket”,ScannedUPC); IF PickHeader.FIND(’-’) THEN BEGIN Rec.GET(PickHeader.“Sales No.”,PickHeader.“Pick No.”,PickHeader.“Pick Slip Ticket”); END ELSE BEGIN … I tried the delayed insert but still get the “Rename Record” message. “Pick slip ticket” is part of the master key. It is also the source table of the form.

Trace the code in debug mode and tell us on which line of code the error is generated. Are you sure that you’re not modifying primary key values somewhere in your code and you’re doing a Record.MODIFY; instead of a Record.RENAME(Value1, [Value2],…); ???###### _________________________________ Tarek Demiati Freelance Navision Developer Email : Telephone : +65 - 906 787 16 _________________________________Edited by - Tarek Demiati on 2001 Sep 07 16:12:15

No modify record. The “Rename Record” error occurs onaftervalidate control “currform.update” I need to update the form to update the reocrds on the form header and sub form lines.

Hi, Maybe CurrForm.UPDATE(FALSE); will work. If you set the parameter to FALSE, this function will not save the record before the system updates the form. Regards, Reijer. Edited by - reijer on 2001 Sep 07 22:11:44

Maybe CurrForm.UPDATE(FALSE); will work. ************* Yes it works perfectly now thanks for your help!!

I was getting the “Do you want to rename the record?” message, and thanks to this thread, managed to solve it. I have a CompanyDimensionDetails table with one field in its primary key; the primary-key OnLookup trigger in the form should list records from a different table (Dimension Values, just the records for dimension COMPANY). The following code finally worked: CurrForm.SAVERECORD; COMMIT; CLEAR(DimValList_form); DimVal_rec.SETRANGE(“Dimension Code”, ‘COMPANY’); DimValList_form.SETTABLEVIEW(DimVal_rec); DimValList_form.LOOKUPMODE(TRUE); IF DimValList_form.RUNMODAL = ACTION::LookupOK THEN BEGIN DimValList_form.GETRECORD(DimVal_rec); Rec.GET(DimVal_rec.Code); CurrForm.UPDATE(FALSE); END;