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!

Journal Entry in backwards

Status
Not open for further replies.

NewCCTech

Technical User
Feb 18, 2010
65
CA
Hi Everyone,

I am writing a program to import GL Journal Entry, but the records came out backwards after insertion. Anyone idea? how can I solve it?

Your suggestions would be greatly appreciate!
 
Sorry Ettienne for mistyping and confusing you!

I mean that the records are lining up in a backward order after insertion, the first inserted record went to the last in the Journal entry list, and the last inserted record went to the first position on the Journal entry list. how can I make it listed as the order I insert them?

Thanks!
 
You need to keep track of the last line number, like this snippet:

Do while True
GLBatchdetail.GoBottom
iLastLine = GLBatchdetail.Fields("TRANSNBR")
GLBatchdetail.RecordClear
GLBatchdetail.Fields("TRANSNBR").PutWithoutVerification (iLastLine) ' Last Transaction Number
GLBatchdetail.RecordCreate 0
GLBatchdetail.Fields("ACCTID").Value = "9950-00-00-00-00"
GLBatchdetail.Fields("TRANSAMT").PutWithoutVerification (iNewCount)
GLBatchdetail.Insert
Loop
 
We call that reverse order :)
The insertion order depends on your code, post a code snippet of how you create and insert the detail records.
Also say what Accpac version you working with.
 
Thank tuba and ettinne!

I try tuba's code in my program, but still no luch. I am using 30 days trial version of Accpac, VS 2008, SQL 2008 and C#.

Here is my code inside a loop. Thanks!

GLBATCH1detail1.GoBottom();
transNum = Int32.Parse(GLBATCH1detail1.Fields.get_FieldByName("TRANSNBR").get_Value().ToString());

GLBATCH1detail1.RecordClear();

szBuffer = transNum;
GLBATCH1detail1.Fields.get_FieldByName("TRANSNBR").set_Value(ref szBuffer);

GLBATCH1detail1.RecordCreate(AccpacCOMAPI.tagViewRecordCreateEnum.VIEW_RECORD_CREATE_NOINSERT);



szBuffer = AccID;
GLBATCH1detail1.Fields.get_FieldByName("ACCTID").set_Value(ref szBuffer);
GLBATCH1detail1.Process();
GLBATCH1detail1.Insert();
GLBATCH1detail1.Read();


GLBATCH1header.Update();//.Insert();
GLBATCH1header.Read();


 
Why doesn't this work?
GLBATCH1detail1.Fields.get_FieldByName("TRANSNBR").set_Value(transNum);
 
What version of Accpac? 5.6, 5.5, 5.4....

In the newer versions of Accpac you do not have to worry about the last line etc, all you need is

GLBATCH1detail1.RecordCreate 0

and it will create the details in the correct order.

 
Hi ettienne,

It is trial version of ACCPAC 5.4.

Also does "GLBATCH1detail1.RecordCreate 0" act the same function as " GLBATCH1detail1.RecordCreate(AccpacCOMAPI.tagViewRecordCreateEnum.VIEW_RECORD_CREATE_NOINSERT);"?


Thanks!
 
Hi Tuba and Ettienne,

I figure out why.

The type of TRANSNBR is char and I converted it to Int in my code. so this why it did not work. Now I define "transnum" as type of string, then it is working.

Thanks for your great help!
 
You don't need all that gobbledygook, you can simplify with
GLBATCH1detail1.RecordCreate 0. There are many ways to skin a cat.

FYI... AccpacCOMAPI.tagViewRecordCreateEnum.VIEW_RECORD_CREATE_NOINSERT = 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top