Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generate ARInvoice C#

Status
Not open for further replies.

bodlela

Programmer
Oct 22, 2009
45
MZ
Hi

I trying to create AR invoices from a excel file with no luck. Im getting "null reference exception - Object reference not set to an instance of an object." on the line: ARINVOICE1headerFields.FieldByName("INVCTYPE").SetValue("2", false); // ' Invoice Type

Please advice

private void GenerateArInvoice(DataSet ds, OleDbConnection con)
{
session = new ACCPAC.Advantage.Session();
session.Init("", "XX", "XX1000", "55A");
session.Open("ADMIN", "ADMIN", "SAMINC", DateTime.Today, 0);
mDBLinkCmpRW = session.OpenDBLink(ACCPAC.Advantage.DBLinkType.Company, ACCPAC.Advantage.DBLinkFlags.ReadWrite);

OpenAndComposeOrderViews();

//criacao do batch
//ARINVOICE1batch.RecordCreate(1);
ARINVOICE1batch.Init();

ARINVOICE1batchFields.FieldByName("BTCHDESC").SetValue("Generated from Softship File on " + DateTime.Now,true) ; //Description
ARINVOICE1batchFields.FieldByName("DATEBTCH").SetValue (DateTime.Now,true);
ARINVOICE1batch.Update();

foreach (DataRow dr in ds.Tables[0].Rows)
{
ARINVOICE1header.Init();
ARINVOICE1header.RecordGenerate(false);
ARINVOICE1headerFields.FieldByName("INVCTYPE").SetValue("2", false); // ' Invoice Type
ARINVOICE1headerFields.FieldByName("IDCUST").SetValue(dr["CUSTOMER"].ToString(),true); // Trim(scsv.Cells(i, 1)) 'Customer Number
ARINVOICE1headerFields.FieldByName("INVCDESC").SetValue(dr["ENTRY DESCRIPTION"].ToString(), false); // Trim(scsv.Cells(i, 2)) ' Invoice Description
ARINVOICE1headerFields.FieldByName("TEXTTRX").SetValue(dr["DOCUMENT TYPE"].ToString(), false); // Trim(scsv.Cells(i, 3)) ' Document Type
ARINVOICE1headerFields.FieldByName("INCAPPLTO").SetValue(dr["APPLY TO"].ToString(), false); // Trim(scsv.Cells(i, 4)) ' Apply-to Document
ARINVOICE1headerFields.FieldByName("IDINVC").SetValue(dr["DOCID"].ToString(), false); // Trim(scsv.Cells(i, 5)) ' Document Number
ARINVOICE1headerFields.FieldByName("ORDRNBR").SetValue(dr["ORDER NUMBER"].ToString(), false); // Trim(scsv.Cells(i, 6)) ' Order Number
ARINVOICE1headerFields.FieldByName("DATEINVC").SetValue(DateTime.Parse(dr["DOCUMENT DATE"].ToString().Replace(".","//")),false); // DateSerial(Year, Month, Day)

OleDbDataAdapter da1 = new OleDbDataAdapter("SELECT * FROM [Sheet1$] WHERE [DOCUMENT NUMBER]='" + dr["DOCID"].ToString() + "' AND [CUSTOMER]='" + dr["CUSTOMER"].ToString() + "'", con);
DataSet ds1 = new DataSet();
da1.Fill(ds1, "ExcelInfo1");

if (ds1.Tables[0].Rows.Count > 0)
{
double vAmt=0;
foreach (DataRow dr1 in ds1.Tables[0].Rows)
{
ARINVOICE1detail1.Init();
ARINVOICE1detail1Fields.FieldByName("IDACCTREV").SetValue(dr1["REVENUE ACCOUNT"].ToString(),true); // = Trim(scsv.Cells(i, 9)) ' Revenue Account

vAmt = double.Parse(dr1["AMOUNT"].ToString())* double.Parse(dr1["RATE"].ToString());// Trim(scsv.Cells(i, 11))

ARINVOICE1detail1Fields.FieldByName("AMTEXTN").SetValue(vAmt,true) ; // ' Extended Amount w/ TIP

ARINVOICE1detail1.Insert();

}
}
ARINVOICE1headerFields.FieldByName("EXCHRATEHC").SetValue(dr["RATE"].ToString(),false);
ARINVOICE1header.Insert();
}
Cleanup();
}
 
Comment out ARINVOICE1header.Init();
and change ARINVOICE1header.RecordGenerate(false); to
ARINVOICE1header.RecordGenerate(2);
 
Hi

thanks for responding. Now, I am getting "Error HRESULT E_FAIL has been returned from a call to a COM component" , it is on "ARINVOICE1detail1.Insert();" line

Please advice

session = new ACCPAC.Advantage.Session();
session.Init("", "XX", "XX1000", "55A");
session.Open("ADMIN", "ADMIN", "MCRDAT", DateTime.Today, 0);
mDBLinkCmpRW = session.OpenDBLink(ACCPAC.Advantage.DBLinkType.Company, ACCPAC.Advantage.DBLinkFlags.ReadWrite);

OpenAndComposeOrderViews();

mDBLinkCmpRW.TransactionBegin();

ARINVOICE1batch.Init();
ARINVOICE1batchFields.FieldByName("BTCHDESC").SetValue("Generated from Softship File on " + DateTime.Now, true); //Description
ARINVOICE1batchFields.FieldByName("DATEBTCH").SetValue(DateTime.Now, true);
ARINVOICE1batch.Update();

foreach (DataRow dr in ds.Tables[0].Rows)
{

ARINVOICE1header.Init();
//ARINVOICE1header.RecordGenerate(2);
ARINVOICE1header.Fields.FieldByName("INVCTYPE").SetValue("2", false); // ' Invoice Type
ARINVOICE1header.Fields.FieldByName("IDCUST").SetValue(dr["CUSTOMER"].ToString(), true); // Trim(scsv.Cells(i, 1)) 'Customer Number
ARINVOICE1header.Fields.FieldByName("INVCDESC").SetValue(dr["ENTRY DESCRIPTION"].ToString(), false); // Trim(scsv.Cells(i, 2)) ' Invoice Description
ARINVOICE1header.Fields.FieldByName("TEXTTRX").SetValue(dr["DOCUMENT TYPE"].ToString(), false); // Trim(scsv.Cells(i, 3)) ' Document Type
//ARINVOICE1header.Fields.FieldByName("INCAPPLTO").SetValue(dr["APPLY TO"].ToString().Trim(), true); // Trim(scsv.Cells(i, 4)) ' Apply-to Document
ARINVOICE1header.Fields.FieldByName("IDINVC").SetValue(dr["DOCID"].ToString(), false); // Trim(scsv.Cells(i, 5)) ' Document Number
ARINVOICE1header.Fields.FieldByName("ORDRNBR").SetValue(dr["ORDER NUMBER"].ToString(), false); // Trim(scsv.Cells(i, 6)) ' Order Number
ARINVOICE1header.Fields.FieldByName("DATEINVC").SetValue(DateTime.Now, false); // DateSerial(Year, Month, Day)

OleDbDataAdapter da1 = new OleDbDataAdapter("SELECT * FROM [Sheet1$] WHERE [DOCUMENT NUMBER]='" + dr["DOCID"].ToString() + "' AND [CUSTOMER NUMBER]='" + dr["CUSTOMER"].ToString() + "'", con);
DataSet ds1 = new DataSet();
da1.Fill(ds1, "ExcelInfo1");

if (ds1.Tables[0].Rows.Count > 0)
{
double vAmt = 0;
int vLine = 0;
ARINVOICE1detail1.Init();
foreach (DataRow dr1 in ds1.Tables[0].Rows)
{
ARINVOICE1detail1.RecordGenerate(false);
//ARINVOICE1detail1.Process();
vLine = vLine + 1;
ARINVOICE1detail1.Fields.FieldByName("IDACCTREV").SetValue(dr1["REVENUE ACCOUNT"].ToString(), true); // = Trim(scsv.Cells(i, 9)) ' Revenue Account

vAmt = double.Parse(dr1["AMOUNT"].ToString()) * double.Parse(dr1["RATE"].ToString());// Trim(scsv.Cells(i, 11))

ARINVOICE1detail1.Fields.FieldByName("AMTEXTN").SetValue(vAmt, false); // ' Extended Amount w/ TIP
ARINVOICE1detail1.Process();
ARINVOICE1detail1.Insert();
ARINVOICE1detail1.Fields.FieldByName("CNTLINE").SetValue((vLine * -1), false);
}
}
ARINVOICE1header.Fields.FieldByName("EXCHRATEHC").SetValue(dr["RATE"].ToString(), false);
ARINVOICE1header.Insert();
mDBLinkCmpRW.TransactionCommit();
}
Cleanup();
 
I should mention that I am getting error when use "ARINVOICE1header.RecordGenerate(2);" VS says: Error 1 The best overloaded method match for 'ACCPAC.Advantage.View.RecordGenerate(bool)' has some invalid arguments
 
Thanks again ettienne but I am getting Error: "The best overloaded method match for 'ACCPAC.Advantage.View.RecordGenerate(bool)' has some invalid arguments" when using ARINVOICE1detail1.RecordGenerate(0);
 
Aw crap you're on 5.5 (assuming from your code).... I'm confusing RecordGenerate and RecordCreate found in 5.6.
RecordGenerate valid arguments are true and false.
My best advice is record a macro in 5.5 and see what it does, then translate the code. Also add an error handler, there may be an accpac error generated.

 
Hi

I have done what ettienne said but still getting the same error "Error HRESULT E_FAIL has been returned from a call to a COM component" , on "ARINVOICE1detail1.Insert();" line. My entire code is as shown below.
Someone please help me on this issue.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ARINVOICE
{
public partial class Form1 : Form
{
private ACCPAC.Advantage.Session session;
private ACCPAC.Advantage.DBLink mDBLinkCmpRW;
private ACCPAC.Advantage.View ARINVOICE1batch;
private ACCPAC.Advantage.View ARINVOICE1header;
private ACCPAC.Advantage.ViewFields ARINVOICE1batchFields;
private ACCPAC.Advantage.ViewFields ARINVOICE1headerFields;
private ACCPAC.Advantage.View ARINVOICE1detail1;
private ACCPAC.Advantage.ViewFields ARINVOICE1detail1Fields;
private ACCPAC.Advantage.View ARINVOICE1detail2;
private ACCPAC.Advantage.ViewFields ARINVOICE1detail2Fields;
private ACCPAC.Advantage.View ARINVOICE1detail3;
private ACCPAC.Advantage.ViewFields ARINVOICE1detail3Fields;
private ACCPAC.Advantage.View ARINVOICE1detail4;
private ACCPAC.Advantage.ViewFields ARINVOICE1detail4Fields;
private ACCPAC.Advantage.View ARINVOICE1detail5;
private ACCPAC.Advantage.ViewFields ARINVOICE1detail5Fields;
private ACCPAC.Advantage.View ARINVOICE1detail6;
private ACCPAC.Advantage.ViewFields ARINVOICE1detail6Fields;
private ACCPAC.Advantage.View ARINVOICE1detail7;
private ACCPAC.Advantage.ViewFields ARINVOICE1detail7Fields;
private ACCPAC.Advantage.View ARINVOICE1detail8;
private ACCPAC.Advantage.ViewFields ARINVOICE1detail8Fields;
private ACCPAC.Advantage.View ARINVOICE1detail9;
private ACCPAC.Advantage.ViewFields ARINVOICE1detail9Fields;
private ACCPAC.Advantage.View ARINVOICE1detail10;
private ACCPAC.Advantage.ViewFields ARINVOICE1detail10Fields;



public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
{

}

private void btnBrowse_Click(object sender, EventArgs e)
{
//Stream myStream = null;
OpenFileDialog openFileDialog1 = new OpenFileDialog();

openFileDialog1.InitialDirectory = "c:\\";
openFileDialog1.Filter = "xls files (*.xls)|*.xls";
openFileDialog1.FilterIndex = 2;
openFileDialog1.RestoreDirectory = true;

if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
//if ((myStream = openFileDialog1.OpenFile()) != null)
//{
// using (myStream)
// {
// // Insert code to read the stream here.
// }
//}
txtFilename.Text = openFileDialog1.FileName;


}
catch (Exception ex)
{
MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
}
}
}

private void btnGenerate_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txtFilename.Text + ";Extended Properties=Excel 8.0");
OleDbDataAdapter da = new OleDbDataAdapter("SELECT DISTINCT [DOCUMENT NUMBER] AS DOCID, [CUSTOMER NUMBER] AS CUSTOMER, [ENTRY DESCRIPTION],[DOCUMENT TYPE],[APPLY TO],[ORDER NUMBER],[DOCUMENT DATE],[CURRENCY], [RATE] FROM [Sheet1$] ", con);
DataSet ds = new DataSet();
da.Fill(ds, "ExcelInfo");

if (ds.Tables[0].Rows.Count > 0)
{
GenerateArInvoice(ds,con);
}


}

private void GenerateArInvoice(DataSet ds, OleDbConnection con)
{
try
{
session = new ACCPAC.Advantage.Session();
session.Init("", "XY", "XY0001", "55A");
session.Open("ADMIN", "ADMIN", "SAMINC", DateTime.Today, 0);
mDBLinkCmpRW = session.OpenDBLink(ACCPAC.Advantage.DBLinkType.Company, ACCPAC.Advantage.DBLinkFlags.ReadWrite);

OpenAndComposeOrderViews();

mDBLinkCmpRW.TransactionBegin();

//ARINVOICE1batch.Init();
ARINVOICE1batch.RecordGenerate(true);

ARINVOICE1batch.Process();
ARINVOICE1batch.Read(false);
ARINVOICE1batchFields.FieldByName("BTCHDESC").SetValue("Generated from Softship File on " + DateTime.Now, true); //Description
ARINVOICE1batchFields.FieldByName("DATEBTCH").SetValue(DateTime.Now, true);
ARINVOICE1batch.Update();

foreach (DataRow dr in ds.Tables[0].Rows)
{

//ARINVOICE1header.Init();
//ARINVOICE1header.RecordGenerate(true);
//ARINVOICE1header.RecordCreate(0);
ARINVOICE1header.RecordClear();
ARINVOICE1header.RecordGenerate(false);
ARINVOICE1header.Fields.FieldByName("PROCESSCMD").SetValue("1", false);
ARINVOICE1header.Fields.FieldByName("INVCTYPE").SetValue("2", false); // ' Invoice Type
ARINVOICE1header.Fields.FieldByName("IDCUST").SetValue(dr["CUSTOMER"].ToString(), true); // Trim(scsv.Cells(i, 1)) 'Customer Number
ARINVOICE1header.Fields.FieldByName("INVCDESC").SetValue(dr["ENTRY DESCRIPTION"].ToString(), true); // Trim(scsv.Cells(i, 2)) ' Invoice Description
ARINVOICE1header.Fields.FieldByName("TEXTTRX").SetValue(dr["DOCUMENT TYPE"].ToString(), true); // Trim(scsv.Cells(i, 3)) ' Document Type
//ARINVOICE1header.Fields.FieldByName("INCAPPLTO").SetValue(dr["APPLY TO"].ToString().Trim(), true); // Trim(scsv.Cells(i, 4)) ' Apply-to Document
ARINVOICE1header.Fields.FieldByName("IDINVC").SetValue(dr["DOCID"].ToString(), true); // Trim(scsv.Cells(i, 5)) ' Document Number
ARINVOICE1header.Fields.FieldByName("ORDRNBR").SetValue(dr["ORDER NUMBER"].ToString(), true); // Trim(scsv.Cells(i, 6)) ' Order Number
//ARINVOICE1header.Fields.FieldByName("DATEINVC").SetValue(DateTime.Now, false); // DateSerial(Year, Month, Day)
//ARINVOICE1header.Process();
OleDbDataAdapter da1 = new OleDbDataAdapter("SELECT * FROM [Sheet1$] WHERE [DOCUMENT NUMBER]='" + dr["DOCID"].ToString() + "' AND [CUSTOMER NUMBER]='" + dr["CUSTOMER"].ToString() + "'", con);
DataSet ds1 = new DataSet();
da1.Fill(ds1, "ExcelInfo1");

if (ds1.Tables[0].Rows.Count > 0)
{
double vAmt = 0;
int vLine = 0;
//ARINVOICE1detail1.Init();
foreach (DataRow dr1 in ds1.Tables[0].Rows)
{
//ARINVOICE1detail1.RecordCreate(0);
ARINVOICE1detail1.RecordClear();
ARINVOICE1detail1.RecordGenerate(false);
//ARINVOICE1detail1.Process();
vLine = vLine + 1;
ARINVOICE1detail1.Fields.FieldByName("IDACCTREV").SetValue(dr1["REVENUE ACCOUNT"].ToString(), false); // = Trim(scsv.Cells(i, 9)) ' Revenue Account
vAmt = double.Parse(dr1["AMOUNT"].ToString());// Trim(scsv.Cells(i, 11))
ARINVOICE1detail1.Fields.FieldByName("SWTAXINCL1").SetValue("1", false);
ARINVOICE1detail1.Fields.FieldByName("AMTEXTN").SetValue(vAmt.ToString(), false); // ' Extended Amount w/ TIP
ARINVOICE1detail1.Process();
ARINVOICE1detail1.Insert();
ARINVOICE1detail1.Fields.FieldByName("CNTLINE").SetValue((vLine * -1), false);
}
}
ARINVOICE1header.Fields.FieldByName("EXCHRATEHC").SetValue(dr["RATE"].ToString(), false);
ARINVOICE1header.Insert();
mDBLinkCmpRW.TransactionCommit();
}
Cleanup();
}
catch(Exception ex)
{
if (session.IsOpened)
{
mDBLinkCmpRW.TransactionRollback();
session.Errors.Clear();
Cleanup();
}
MyErrorHandler(ex);
}

}



private void Cleanup()
{

ARINVOICE1detail10Fields = null;
ARINVOICE1detail10 = null;
ARINVOICE1detail9Fields = null;
ARINVOICE1detail9 = null;
ARINVOICE1detail8Fields = null;
ARINVOICE1detail8 = null;
ARINVOICE1detail7Fields = null;
ARINVOICE1detail7 = null;
ARINVOICE1detail6Fields = null;
ARINVOICE1detail6 = null;
ARINVOICE1detail5Fields = null;
ARINVOICE1detail5 = null;
ARINVOICE1detail4Fields = null;
ARINVOICE1detail4 = null;
ARINVOICE1detail3Fields = null;
ARINVOICE1detail3 = null;
ARINVOICE1detail2Fields = null;
ARINVOICE1detail2 = null;
ARINVOICE1detail1Fields = null;
ARINVOICE1detail1 = null;
ARINVOICE1headerFields = null;
ARINVOICE1header = null;
ARINVOICE1batch = null;
mDBLinkCmpRW = null;

}

private void OpenAndComposeOrderViews()
{
try
{

ARINVOICE1batch = mDBLinkCmpRW.OpenView("AR0031");
ARINVOICE1batchFields = ARINVOICE1batch.Fields;

ARINVOICE1header = mDBLinkCmpRW.OpenView("AR0032");
ARINVOICE1headerFields = ARINVOICE1header.Fields;

ARINVOICE1detail1 = mDBLinkCmpRW.OpenView("AR0033");
ARINVOICE1detail1Fields = ARINVOICE1detail1.Fields;

ARINVOICE1detail2 = mDBLinkCmpRW.OpenView("AR0034");
ARINVOICE1detail2Fields = ARINVOICE1detail2.Fields;

ARINVOICE1detail3 = mDBLinkCmpRW.OpenView("AR0402");
ARINVOICE1detail3Fields = ARINVOICE1detail3.Fields;

ARINVOICE1detail4 = mDBLinkCmpRW.OpenView("AR0401");
ARINVOICE1detail4Fields = ARINVOICE1detail4.Fields;

//ARINVOICE1detail5 = mDBLinkCmpRW.OpenView("OE0526");
//ARINVOICE1detail5Fields = ARINVOICE1detail5.Fields;

//ARINVOICE1detail6 = mDBLinkCmpRW.OpenView("OE0522");
//ARINVOICE1detail6Fields = ARINVOICE1detail6.Fields;

//ARINVOICE1detail7 = mDBLinkCmpRW.OpenView("OE0501");
//ARINVOICE1detail7Fields = ARINVOICE1detail7.Fields;

//ARINVOICE1detail8 = mDBLinkCmpRW.OpenView("OE0502");
//ARINVOICE1detail8Fields = ARINVOICE1detail8.Fields;

//ARINVOICE1detail9 = mDBLinkCmpRW.OpenView("OE0504");
//ARINVOICE1detail9Fields = ARINVOICE1detail9.Fields;

//ARINVOICE1detail10 = mDBLinkCmpRW.OpenView("OE0503");
//ARINVOICE1detail10Fields = ARINVOICE1detail10.Fields;

ARINVOICE1header.Compose(new ACCPAC.Advantage.View[] { ARINVOICE1batch, ARINVOICE1detail1, ARINVOICE1detail2, ARINVOICE1detail3 });

ARINVOICE1detail1.Compose(new ACCPAC.Advantage.View[] { ARINVOICE1header, ARINVOICE1batch, ARINVOICE1detail4 });

ARINVOICE1detail2.Compose(new ACCPAC.Advantage.View[] { ARINVOICE1header });

ARINVOICE1detail3.Compose(new ACCPAC.Advantage.View[] { ARINVOICE1header });

ARINVOICE1detail4.Compose(new ACCPAC.Advantage.View[] { ARINVOICE1detail1});

//ARINVOICE1detail5.Compose(new ACCPAC.Advantage.View[] { ARINVOICE1header });

//ARINVOICE1detail6.Compose(new ACCPAC.Advantage.View[] { ARINVOICE1header });

//ARINVOICE1detail7.Compose(new ACCPAC.Advantage.View[] { ARINVOICE1detail1 });

//ARINVOICE1detail8.Compose(new ACCPAC.Advantage.View[] { ARINVOICE1detail1, ARINVOICE1detail9 });

//ARINVOICE1detail9.Compose(new ACCPAC.Advantage.View[] { ARINVOICE1detail8 });

//ARINVOICE1detail10.Compose(new ACCPAC.Advantage.View[] { ARINVOICE1detail1 });
}
catch (Exception e)
{
MyErrorHandler(e);
}

}

private void MyErrorHandler(Exception e)
{
long lCount;
int iIndex;

if (session.Errors == null)
{
MessageBox.Show(e.Message);
}
else
{
lCount = session.Errors.Count;

if (lCount == 0)
{
MessageBox.Show(e.Message);
}
else
{
for (iIndex = 0; iIndex < lCount; iIndex++)
{
MessageBox.Show(session.Errors[iIndex].Message);

}
session.Errors.Clear();
}
}

}

}
}
 
Sorry, the MyErrorHandler code was missing.

private void MyErrorHandler(Exception e)
{
long lCount;
int iIndex;

if (session.Errors == null)
{
MessageBox.Show(e.Message);
}
else
{
lCount = session.Errors.Count;

if (lCount == 0)
{
MessageBox.Show(e.Message);
}
else
{
for (iIndex = 0; iIndex < lCount; iIndex++)
{
MessageBox.Show(session.Errors[iIndex].Message);

}
session.Errors.Clear();
}
}

}
 
Run rvSpy when you execute the .Insert line and you should be able to figure why you're getting the error.
 
Which version of Accpac?
Have you recorded a macro and compared it to your code?
 
Hi

My Accpac version is 55A. Can someone help me understanding RVSPY file please? I copied the last lines.

Thanks

[1094] AR0500: AROFD [20:24:59.92].Presents(view=0x0C85523C, field=1, count=16, size=114)
[1094] 0 <==[20:24:59.92;t=0;ovh=0] {count=8, list=0$1$2$3$4$5$6$7$ strings='Customers and Customer Groups$Ship-To Locations$Invoices$Invoice Details$Receipts$Adjustments$Revaluation$Refunds$'}
[1094] AR0500: AROFD [20:24:59.92].Close(view=0x0C85523C)
[1094] TRACE: *** Optional field cache dump ***
[1094] CS0012: CSOPTFD [20:24:59.92].Close(view=0x0C857A9C)
[1094] 0 <==[20:24:59.92;t=0;ovh=0] {}
[1094] CS0012: CSOPTFD [20:24:59.92].Unload
[1094] 0 <==[20:24:59.92;t=0;ovh=0] {}
[1094] AR0500: AROFD [20:24:59.92].Unload
[1094] 0 <==[20:24:59.93;t=32;ovh=16] {}
[1094] AR0033: ARIBD [20:24:59.93].Insert(view=0x043023AC)
[1094] AR0032: ARIBH [20:24:59.93].Put(view=0x042E9D54, field=15, size=2, verify=0, buffer='\00\00')
[1094] 0 <==[20:24:59.93;t=0;ovh=0] {}
[1094] AR0032: ARIBH [20:24:59.93].BlkGet(view=0x042E9D54, count=8, fields/sizes=22/3$146/3$104/5$25/8$148/8$108/2$151/2$147/2$)
[1094] 0 <==[20:24:59.93;t=0;ovh=0] BlkGet return
[1094] * field=22, size=3, buffer='\4d\5a\4e' -> 'MZN'
[1094] * field=146, size=3, buffer='\4d\5a\4e' -> 'MZN'
[1094] * field=104, size=5, buffer='\02\01\11\10\9c' -> 20111109
[1094] * field=25, size=8, buffer='\00\00\00\01\00\00\00\0c' -> 10000000
[1094] * field=148, size=8, buffer='\00\00\00\01\00\00\00\0c' -> 10000000
[1094] * field=108, size=2, buffer='\01\00'
[1094] * field=151, size=2, buffer='\01\00'
[1094] * field=147, size=2, buffer='\01\00'
[1094] GL0001: GLAMF [20:24:59.93].Put(view=0x0C845AF4, field=1, size=45, verify=1, buffer='\31\31\31\31\30\30\30\30\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20' -> '11110000 ')
[1094] 0 <==[20:24:59.93;t=0;ovh=0] {}
[1094] GL0001: GLAMF [20:24:59.93].Put(view=0x0C845AF4, field=1, size=45, verify=0, buffer='\31\31\31\31\30\30\30\30\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20' -> '11110000 ')
[1094] 0 <==[20:24:59.93;t=0;ovh=0] {}
[1094] GL0001: GLAMF [20:24:59.93].Read(view=0x0C845AF4)
[1094] 0 <==[20:24:59.93;t=0;ovh=0] {}
[1094] GL0001: GLAMF [20:24:59.93].Get(view=0x0C845AF4, field=6, size=2)
[1094] 0 <==[20:24:59.93;t=0;ovh=0] {buffer='\01\00'}
[1094] GL0001: GLAMF [20:24:59.93].Get(view=0x0C845AF4, field=21, size=45)
[1094] 0 <==[20:24:59.93;t=0;ovh=0] {buffer='\31\31\31\31\30\30\30\30\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20' -> '11110000 '}
[1094] GL0001: GLAMF [20:24:59.93].Get(view=0x0C845AF4, field=3, size=60)
[1094] 0 <==[20:24:59.93;t=0;ovh=0] {buffer='\43\61\69\78\61\73\20\43\65\6e\74\72\61\69\73\20\2d\20\4d\5a\4e\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20' -> 'Caixas Centrais - MZN '}
[1094] AR0032: ARIBH [20:24:59.93].BlkGet(view=0x042E9D54, count=2, fields/sizes=22/3$146/3$)
[1094] 0 <==[20:24:59.93;t=0;ovh=0] BlkGet return
[1094] * field=22, size=3, buffer='\4d\5a\4e' -> 'MZN'
[1094] * field=146, size=3, buffer='\4d\5a\4e' -> 'MZN'
[1094] AR0032: ARIBH [20:24:59.93].Get(view=0x042E9D54, field=142, size=2)
[1094] 0 <==[20:24:59.93;t=0;ovh=0] {buffer='\41\52'}
[1094] 1024 <==[20:24:59.93;t=0;ovh=0] {**ERROR**}
 
Which version of Accpac?
Have you recorded a macro and compared it to your code?
 
Hi ettienne

Which version of Accpac?
Accpac 55A
Have you recorded a macro and compared it to your code?
Yes, that was my first step.
 
There are differences between an AR 5.5 recorded macro and your code. Clean up your code and go back to what was recoded.
FWIW get a VBA macro running without error first and then port that code to your app.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top