Transaction Error

upasanisandip
upasanisandip Member Posts: 405
Hi everyone,
Does any know about this error.

You cannot make any changes in the database until a transaction has been started.

Thanks,
Sandip.

Comments

  • easabangan
    easabangan Member Posts: 114
    Where does this error occur?
    No future at CPI
  • upasanisandip
    upasanisandip Member Posts: 405
    i have written one function to insert record in one new table created by me in the following event

    Form-onNextRecord()
    InsertRecordIntoInvoiceSrno;


    InsertRecordIntoInvoiceSrno()
    InvoiceItemSrNo1.INIT;
    InvoiceItemSrNo1."Vendor Code":="Buy-from Vendor No.";
    InvoiceItemSrNo1."Item Code":="No.";
    InvoiceItemSrNo1.INSERT;
  • upasanisandip
    upasanisandip Member Posts: 405
    i have written one function to insert record in one new table created by me in the following event

    Form-onNextRecord()
    InsertRecordIntoInvoiceSrno;


    InsertRecordIntoInvoiceSrno()
    InvoiceItemSrNo1.INIT;
    InvoiceItemSrNo1."Vendor Code":="Buy-from Vendor No.";
    InvoiceItemSrNo1."Item Code":="No.";
    InvoiceItemSrNo1.INSERT;

    In purchase line subform i am writing this function.
  • kine
    kine Member Posts: 12,562
    You cannot modify DB in OnNextRecord. This trigger is just for reading the DB...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DenSter
    DenSter Member Posts: 8,307
    It's not really a good idea to program any data manipulation in the form. If you have no choice but to have a form event modify data, you should program the thing as a function in the table and call the function from the form.
  • jelias56
    jelias56 Member Posts: 10
    Yes ... it cost me a day of development time. No one I know had heard of such an error. I called a code unit that manipulated data on the OnInitDataport trigger of a dataport. After a day of frustration, I moved the code to the OnPreDataport trigger and the problem disappeared.
    Don't blame me. It's the hardware.
    j
  • petevans
    petevans Member Posts: 78
    The same applies to triggers in Forms. You will get this error if you put a "MODIFY" in trigger OnNewRecord on forms.

    PS: There is an older thread discussing the same topic here:

    http://www.mibuso.com/forum/viewtopic.php?t=9570&highlight=cannot+make+changes+database+transaction+started
    NAVN00b