We have a problem using a COM Automation object with a following function interface: MyFunction(long lrow, variant Value) Allthough the Navision C/SIDE help claims that an integer corresponds to long integer (VT_I4), passing an integer instead of long causes Attain (3.01B) to crash. Is this a known problem? Is there a way to cast integer to long int?
Ok, I’ll withdraw this question, because the problem has been found. First I’ll explain what we were trying to do, so you get the picture. We were making a connection to another financials software through COM automation. The other softwares COM object that reprecents an entry in its general ledger, has a method SetValueOnRow, which uses three parameters; row, fieldname, value. The problem was that parameter “row” which is type long, made Attain crash each time we tried to compile this codeunit. This happened only when we used a Global (or Local) of type integer for the “row”-parameter. If we substituted the Global with a hardcoded number, the codeunit compiled ok. We had a WITH-DO statement block for this Automation Object (I have removed lines to simplify it): Globals: // row, integer // “G/L Entry”, record “G/L Entry” // AutGLEntry, Automation Code: WITH AutGLEntry DO BEGIN SetValueOnRow(row,‘Credit’,“G/L Entry”.“Credit Amount”); END; The “cure” for the problem was to remove the WITH-DO statement block, so the code above should look like this: AutGLEntry.SetValueOnRow(row,‘Credit’,“G/L Entry”.“Credit Amount”); After doing this, everything goes fine. Thought that I should let you know… sometimes you just have to make guesses and vary syntax to get of the hook. /Pauli