List(F5) function implementation on primary key

hi I want to implement the List(F5) function property on the primary key field of a table. I have written the code thus CurrForm.SAVERECORD; CLEAR(AIJobMastersList); AIJobMastersList.LOOKUPMODE(TRUE); IF AIJobMastersList.RUNMODAL = ACTION::LookupOK THEN BEGIN AIJobMastersList.GETRECORD(AIJobMaster); “Job No.”:=AIJobMaster.“Job No.”; END; CurrForm.UPDATE(FALSE); and the ‘delayedinsert’ prop of the form is set to ‘yes’ bcoz the primarykey is calculated after some of the controls on the form have been input…the problem is as soon as the controls have been input and the key is generated if i lookup into the field the system gives the following error message " the following c/al functions can be used only to a limited degree during write transactions(because one or more tables will be locked) form.runmodal() is not allowed in write transactions." kumar Edited by - mvgs on 2001 Nov 28 04:58:20

Who do this - Why not just use the TableRelation Property. Then You do not need to do any programming? //Henrik Helgesen -: KISS::Keep it Simple, Stupid :-

quote:


Originally posted by Hhelgesen: Who do this - Why not just use the TableRelation Property. Then You do not need to do any programming? hi when u F5 all the fields will be updated on the form wrt that record…but if we do a simple table relation then only that field will be updated…hope u got my point kumar //Henrik Helgesen -: KISS::Keep it Simple, Stupid :-


F5 is supposed just to move set as current record an existant one, not to copy. When you’ve to choose a value on a serie of availables ones is usually F6 (Lookup). F5 code emulation should be something like: CurrForm.SAVERECORD; CLEAR(AIJobMastersList); AIJobMastersList.LOOKUPMODE(TRUE); IF AIJobMastersList.RUNMODAL = ACTION::LookupOK THEN BEGIN AIJobMastersList.GETRECORD(AIJobMaster); // Now just a Rec.GET(Keyfields) will work… if not, you can also use: Rec := AiJobMaster; Rec.FIND; // that will return as actual record the one you choosed. END; Alfonso Pertierra (Spain)apertierra@teleline.es

hi Alfonso your piece of code works fine …it was working fine with what i have written also, but the problems is immeadiately after the job number is generated and if do the lookup on the jobnumber then the error mentioned in my first message is raised and the record is not inserted and on the otherway after the number is generated and if i go to next record or clik F3 then the previously created record exists and even the F5 functinality works fine…hope you understood what i meant… thanks in advance kumar

Try adding setting these lines as first ones: CurrForm.UPDATE(TRUE); COMMIT; SELECTLATESTVERSION; // and then the clear(AiJob… etc). Alfonso Pertierra (Spain)apertierra@teleline.es

hi Alfonso thanks it works now… kumar