I have been able to Connect in vb6 (not ACCPAC VBA) using the AccpacCOMAPI
using the following code:
'--------------
'--------------
' start
'--------------
'--------------
Dim mySession As New AccpacCOMAPI.AccpacSession
Dim mySignonManager As New AccpacSignonManager.AccpacSignonMgr
mySession.Init "", "CS", "CS0001", "51A"
mySignonManager.Signon mySession
On Error GoTo ACCPACErrorHandler
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkCmpRW = mySession.OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE) ' DBLINK_COMPANY is 1 and DBLINK_FLG_READWRITE is 0
Dim mDBLinkSysRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkSysRW = mySession.OpenDBLink(DBLINK_SYSTEM, DBLINK_FLG_READWRITE) ' DBLINK_SYSTEM is 0 and DBLINK_FLG_READWRITE is 0
Dim OEORD1header As AccpacCOMAPI.AccpacView
Dim OEORD1headerFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0520", OEORD1header
Set OEORD1headerFields = OEORD1header.Fields
Dim OEORD1detail1 As AccpacCOMAPI.AccpacView
Dim OEORD1detail1Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0500", OEORD1detail1
Set OEORD1detail1Fields = OEORD1detail1.Fields
Dim OEORD1detail2 As AccpacCOMAPI.AccpacView
Dim OEORD1detail2Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0740", OEORD1detail2
Set OEORD1detail2Fields = OEORD1detail2.Fields
Dim OEORD1detail3 As AccpacCOMAPI.AccpacView
Dim OEORD1detail3Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0180", OEORD1detail3
Set OEORD1detail3Fields = OEORD1detail3.Fields
Dim OEORD1detail4 As AccpacCOMAPI.AccpacView
Dim OEORD1detail4Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0680", OEORD1detail4
Set OEORD1detail4Fields = OEORD1detail4.Fields
OEORD1header.Compose Array(OEORD1detail1, OEORD1detail4, OEORD1detail3, OEORD1detail2, Nothing, Nothing, Nothing, Nothing, Nothing)
OEORD1detail1.Compose Array(OEORD1header, Nothing)
OEORD1detail2.Compose Array(OEORD1header, Nothing)
OEORD1detail3.Compose Array(OEORD1header, Nothing, OEORD1detail1)
OEORD1detail4.Compose Array(OEORD1header, Nothing, OEORD1detail1)
OEORD1header.Cancel
OEORD1header.Init
' do header fields
OEORD1headerFields("CUSTOMER".Value = "MICR15"
OEORD1headerFields("ORDNUMBER".Value = "TEST2"
OEORD1headerFields("LOCATION".Value = "MTR"
' do first detail
OEORD1detail1.Init
OEORD1detail1Fields("ITEM".Value = "PL1100SRG54582"
OEORD1detail1Fields("QTYORDERED".Value = "10.0000"
OEORD1detail1Fields("COMMINST".Value = "1"
' do comments for first detail
OEORD1detail3.Init
OEORD1detail3Fields("COIN".PutWithoutVerification ("c1"
OEORD1detail3.Insert
OEORD1detail3.Init
OEORD1detail3Fields("COIN".PutWithoutVerification ("c2"
OEORD1detail3.Insert
' insert first detail
OEORD1detail1.Insert
' do second detail
OEORD1detail1.Init
OEORD1detail1Fields("ITEM".Value = "PL4000SC411869005E"
OEORD1detail1Fields("QTYORDERED".Value = "10.0000"
OEORD1detail1Fields("COMMINST".Value = "1"
' do comments for second detail
OEORD1detail3.Init
OEORD1detail3Fields("COIN".PutWithoutVerification ("cc1"
OEORD1detail3.Insert
OEORD1detail3.Init
OEORD1detail3Fields("COIN".PutWithoutVerification ("cc2"
OEORD1detail3.Insert
OEORD1detail3.Init
OEORD1detail3Fields("COIN".PutWithoutVerification ("cc3"
OEORD1detail3.Insert
' insert second detail
OEORD1detail1.Insert
' insert header
OEORD1header.Insert
'--------------
'--------------
' end
'--------------
'--------------
But the thing is that i never specified the company / user / pass
This code took one company by default, ok i have just one company in my test environnement
But i would like to knows a way to be sure i select the desired company,
because in my production environnement there is many company .
Then when is use : mySession.Init "", "CS", "CS0001", "51A"
i just use the code of an example i found in a thread,
I don't realy know what "CS" or ""CS0001" is for, "51A" is for my version but i'm not sure if i do this right....
the good thing is that with that code, i have been able to enter an Order Entry succesfuly ...
And when i try to use the xAPI (ACCPACXAPILib 1.1)
I am able to choose the good company and enter a order entry but for multiple detail in my order entry
i need to commit the header for each line of detail. (!!TIME WASTING!!!)
If i don't, only the last detail will be inserted...!!!
Strange thing because for the comment parts i don't have to commit for each row...!
It's seems to be a bug or something or i make something wrong and i'm not able to see it.
Any help on this would be appreciated
using the following code:
'--------------
'--------------
' start
'--------------
'--------------
Dim mySession As New AccpacCOMAPI.AccpacSession
Dim mySignonManager As New AccpacSignonManager.AccpacSignonMgr
mySession.Init "", "CS", "CS0001", "51A"
mySignonManager.Signon mySession
On Error GoTo ACCPACErrorHandler
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkCmpRW = mySession.OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE) ' DBLINK_COMPANY is 1 and DBLINK_FLG_READWRITE is 0
Dim mDBLinkSysRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkSysRW = mySession.OpenDBLink(DBLINK_SYSTEM, DBLINK_FLG_READWRITE) ' DBLINK_SYSTEM is 0 and DBLINK_FLG_READWRITE is 0
Dim OEORD1header As AccpacCOMAPI.AccpacView
Dim OEORD1headerFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0520", OEORD1header
Set OEORD1headerFields = OEORD1header.Fields
Dim OEORD1detail1 As AccpacCOMAPI.AccpacView
Dim OEORD1detail1Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0500", OEORD1detail1
Set OEORD1detail1Fields = OEORD1detail1.Fields
Dim OEORD1detail2 As AccpacCOMAPI.AccpacView
Dim OEORD1detail2Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0740", OEORD1detail2
Set OEORD1detail2Fields = OEORD1detail2.Fields
Dim OEORD1detail3 As AccpacCOMAPI.AccpacView
Dim OEORD1detail3Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0180", OEORD1detail3
Set OEORD1detail3Fields = OEORD1detail3.Fields
Dim OEORD1detail4 As AccpacCOMAPI.AccpacView
Dim OEORD1detail4Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0680", OEORD1detail4
Set OEORD1detail4Fields = OEORD1detail4.Fields
OEORD1header.Compose Array(OEORD1detail1, OEORD1detail4, OEORD1detail3, OEORD1detail2, Nothing, Nothing, Nothing, Nothing, Nothing)
OEORD1detail1.Compose Array(OEORD1header, Nothing)
OEORD1detail2.Compose Array(OEORD1header, Nothing)
OEORD1detail3.Compose Array(OEORD1header, Nothing, OEORD1detail1)
OEORD1detail4.Compose Array(OEORD1header, Nothing, OEORD1detail1)
OEORD1header.Cancel
OEORD1header.Init
' do header fields
OEORD1headerFields("CUSTOMER".Value = "MICR15"
OEORD1headerFields("ORDNUMBER".Value = "TEST2"
OEORD1headerFields("LOCATION".Value = "MTR"
' do first detail
OEORD1detail1.Init
OEORD1detail1Fields("ITEM".Value = "PL1100SRG54582"
OEORD1detail1Fields("QTYORDERED".Value = "10.0000"
OEORD1detail1Fields("COMMINST".Value = "1"
' do comments for first detail
OEORD1detail3.Init
OEORD1detail3Fields("COIN".PutWithoutVerification ("c1"
OEORD1detail3.Insert
OEORD1detail3.Init
OEORD1detail3Fields("COIN".PutWithoutVerification ("c2"
OEORD1detail3.Insert
' insert first detail
OEORD1detail1.Insert
' do second detail
OEORD1detail1.Init
OEORD1detail1Fields("ITEM".Value = "PL4000SC411869005E"
OEORD1detail1Fields("QTYORDERED".Value = "10.0000"
OEORD1detail1Fields("COMMINST".Value = "1"
' do comments for second detail
OEORD1detail3.Init
OEORD1detail3Fields("COIN".PutWithoutVerification ("cc1"
OEORD1detail3.Insert
OEORD1detail3.Init
OEORD1detail3Fields("COIN".PutWithoutVerification ("cc2"
OEORD1detail3.Insert
OEORD1detail3.Init
OEORD1detail3Fields("COIN".PutWithoutVerification ("cc3"
OEORD1detail3.Insert
' insert second detail
OEORD1detail1.Insert
' insert header
OEORD1header.Insert
'--------------
'--------------
' end
'--------------
'--------------
But the thing is that i never specified the company / user / pass
This code took one company by default, ok i have just one company in my test environnement
But i would like to knows a way to be sure i select the desired company,
because in my production environnement there is many company .
Then when is use : mySession.Init "", "CS", "CS0001", "51A"
i just use the code of an example i found in a thread,
I don't realy know what "CS" or ""CS0001" is for, "51A" is for my version but i'm not sure if i do this right....
the good thing is that with that code, i have been able to enter an Order Entry succesfuly ...
And when i try to use the xAPI (ACCPACXAPILib 1.1)
I am able to choose the good company and enter a order entry but for multiple detail in my order entry
i need to commit the header for each line of detail. (!!TIME WASTING!!!)
If i don't, only the last detail will be inserted...!!!
Strange thing because for the comment parts i don't have to commit for each row...!
It's seems to be a bug or something or i make something wrong and i'm not able to see it.
Any help on this would be appreciated