Transaction init Problem

Hi dynamic masters,

I got a new error message calling a function that inserts a new record. The function works great when I call it from a command button but I need to call it automatically after getting a record, right now I call it in the OnAfterRecord trigger but the error message displays “You cannot make any changes in the database until a transaction has been started”. I tried debugging and the error is in the first line of the function (INIT;).

Any suggestion?

It would be a good idea to give a little more information upon your exact requirements in order for the community to best answer your question.

But in short, just like the error message says - you will not be able to make modifications to the database from the trigger you have placed your code in.

i would also suggest that it would not be wise to “create” a new record every time you get a record, is this code in a card form or a list form also?

what is the issue with calling this function from a command button? Do you want the process automated?
You could try some using the Onmodify trigger in the table?
It’s hard to say until we have a more specific understanding of what you want to achieve.

You’re right littleoaks, I didn’t want to be tedious, I try to explain…

I got a form “Intervention Card” linked to table “Intervention” and another table “Alarms”. When I create a new intervention I want to automatically create and alarm for a forward day. I use the function createAlarm and works correctly when it’s invoked from a command button but automatically fails !!. The function is:

newAlarm(codFormLaunch : Integer;codRegLaunch : Code[20];fechaAviso : Date;horaAviso : Time;avisoA : Code[10];aviso : Text[50];mostrarForm: boolean)

Code := newCodigoAlarma;
fechaIns := TODAY;
horaIns := TIME;
fechaAlarma := fechaAviso;
horaAlarma := horaAviso;
usuarioAlarma := avisoA;
mensaje := aviso;
codForm := codFormLaunch;
codReg := codRegLaunch;

The call is… form50001.newAlarm(50007, Code, Fecha + 4, Hora, USERID, ‘’, TRUE)

As I said when debugging the error appears in line INIT;

Did I explain better? Thanks a lot

Since you need to create automatically an alarm every time you create a intervention, better to copy the function and put it into the intervention table. In the intervention table → OnInsert() → call the function


I agree with Purday, But you may have to be careful as to when the Intervention record is created, as you will want to ensure you have all the mapped fields populated first.

It may be worthwhile revamping the code a little and placing the call to the new function in the OnModify Trigger of the table.

Then check to see if alarm record exist and modify as necessary.

Hope this helps a little.