Hi! Thanks for the help. It seems that Codeunit 1 causes the problems. I moved the code inta a form (on open trigger) and It worked well

Kine: I also added the check for ISCLEAR(). Thank you
Hi! I am testing a little codeunit which is supposed to be triggered once per minute.
I have made a single instance codeunit and calls it in codeunit 1 when logging in.
If I use av Native database ( version 4.0 sp1) It all works great, but if I do the same on SQL, I get a number of errors when changing company or trying to exit the database.
(Error in module xxxx, appears a couple of times ).
Do some of you know what I am doing wrong or can I do it differently?
// Here is the code :
OBJECT Codeunit 70088 TEST Navision Timer
{
OBJECT-PROPERTIES
{
Date=14.02.06;
Time=17:28:23;
Modified=Yes;
Version List=;
}
PROPERTIES
{
SingleInstance=Yes;
OnRun=BEGIN
IF CREATE(NavTimer) THEN
BEGIN
NavTimer.Interval(10000);
NavTimer.Enabled(TRUE);
END;
END;
}
CODE
{
VAR
NavTimer@1000000001 : Automation "{3B311C81-140E-11D5-8B18-00D0590B4EC5} 1.0:{3B311C92-140E-11D5-8B18-00D0590B4EC5}:'Navision Timer 1.0'.Timer" WITHEVENTS;
PROCEDURE TestFunction@1000000000();
BEGIN
MESSAGE('hi');
END;
EVENT NavTimer@1000000001::Timer@1(Milliseconds@1000000000 : Integer);
BEGIN
TestFunction();
END;
EVENT NavTimer@1000000001::TimerError@2(ErrorString@1000000000 : Text[1024]);
BEGIN
END;
BEGIN
END.
}
}
Answers
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Try to use the codeunit as local variable in the CU1, not global.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
OnRun:
autTimer::Timer(Milliseconds : Integer)
And all works without any problem.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
But I run the codeunit like this:
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!