Internal error 2 in module 5 and 7

kolaboykolaboy Member Posts: 446
HI,
I wrote a code in codeunit 1 in the onOpencompany trigger which tracts users or client machines IP addresses upon opening company. This IP are reflected in the change log entry report. The code is working fine for me.


The problem now is when you close Navision it gives you the following error:
Internal error 2 in module 5. Contact your dealer if you need assistant
and when you click ok, another error occurs which runs thus:
Internal error 2 in module 7. Contact your dealer if you need assistant

Do anyone one know how to get rid of this error?
Here is the code:
IF ISCLEAR(WindowShell) THEN
  CREATE(WindowShell);
 WindowShell.CurrentDirectory(ENVIRON('windir') + '\system32\');
     txtCommand := 'ipconfig';
     WSHExec := WindowShell.Exec(txtCommand);
     WSHTextStream := WSHExec.StdOut;

     i := 0;
     WHILE (NOT WSHTextStream.AtEndOfStream) AND (i < 8) DO BEGIN
      txtMsg := WSHTextStream.ReadLine();
      i +=  1;
     END;


IF GUIALLOWED THEN
     UserSetup."User ID" := USERID;
     UserSetup."IP Address" := COPYSTR(txtMsg,45);
     recRef.GETTABLE(UserSetup);
     UserSetup."IP Address" := '';
     xrecref.GETTABLE(UserSetup);
     ChangeLogMgt.LogModification(recRef,xrecref);
Thanks

Comments

  • kinekine Member Posts: 12,562
    This error was discussed many times on the forum. You can search for the solutions. In enerally, main source of problem is definning the variable as Global/Local in CU1. Define the variable on same place as the standard variables used in the trigger are defined.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kolaboykolaboy Member Posts: 446
    I have searched but i could not see any solution.
    Can someone help me with the link to the solution please.
    Thanks
  • tinoruijstinoruijs Member Posts: 1,226
    kolaboy wrote:
    I have searched but i could not see any solution.
    Can someone help me with the link to the solution please.
    Thanks

    Did you search for "error 2 in module 5"? And use "Search for all terms".
    I always use "Search for all terms" when searching.

    You'll find a lot of posts..
    For example:

    http://www.mibuso.com/forum/viewtopic.php?t=10662&highlight=error++module

    Tino Ruijs
    Microsoft Dynamics NAV specialist
Sign In or Register to comment.