Hi all, Let me try to state my problem with an example. Say,I want to insert some records into a customized table,one for each location from the Location table, for each Item. I am writting this code in the onaftergetcurrrecord of Item Card. Now, when I try to open the card it shows the error message( See Subject) please provide solution.
I think, that you can’t make changes in DB on this trigger. Why do you want to do that here?
Not all triggers allow database modifications that is of them.
You may want to look at report 5706 - Create stockkeeping unit this is a good method of creating entries in a table relating to the item table. I set up a similiar report that runs in the job scheduler, so it creates entries for all new items created, I set a filter on the report to a field on the item card that is blank by defualt, this identifies all new items, my report then creates the entries and then updates the field on the item card, so it doesn’t get included the next time the report is ran.
To create records that aren’t needed to be created automatically you should look at themave answer. This is the correct way to create related records without changing standard code.
You should also look at the Insert trigger in table. That trigger allows you to change data when a record is created. Trigger mention by you happens when you load a record from database not when records is changed or inserted.
Thanx to all of you. Actually my requirement: There is to be a form similar to Item Card, where the users when opens or changes the record(Item), in some subforms the data from different table is to be shown. That is why I tried to insert records to these new tables, on which the subforms will be based,when the users are choosing that particular Item, I don’t require that data otherwise.
Is this data used only on subform? If so, maybe you can use temporrary record - insert it and show on subform.