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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ACCPAC connection COM or xAPI? 1

Status
Not open for further replies.

POSOL

Programmer
Jul 2, 2004
16
CA
Hi,

I am trying to connect to ACCPAC "server" (if one can call it server). It is my first experience with ACCPAC so sorry for possibly newbie questions.

I am writing stand alone VB6.0 application which is intended to connect to ACCPAC Advantage 5.2A and (at least) get (reserve) Batch Number for the new batch of invoices.
Back end for ACCPAC is a SQL server.

Q1: What is ACCPAC ‘server’ on the lower level? How does it work? I have not seen any services running in the system, no software that represents business logic or user authorization.

Q2: I was reading many posts on this Forum and found some controversies: Do I have to use COM API or xAPI to establish connection to the ‘server’? (I saw one post saying that COM will simplify my life here, and there was one more saying that COM API for internal use from ACCPAC VBA only)

Q3: Can I connect to ACCPAC 'server' remotely or ACCPAC 'server' should run on the same machine I am working? (I thought that:

Session.Open "ADMIN", "ADMIN", "accpac-data", Date, 0

->accpac-data parameter is ODBC connection name (to connect remotely), but I saw one post saying that it is company name for ACCPAC authorization)

I have many more questions, but let's keep them for later!

Would appreciate any responds,
Thank you in advance.
 
WELL,

I got allmost all the unsvers by now, the only thing I do not know - "How this system works on the low level?
 
Q1: I am not sure what you mean by ACCPAC "server". I think it just refers to the ACCPAC program SM and objects. The business logic is contained in the ACCPAC views. You will be using the same views that the ACCPAC program uses, thus maintaining the ACCPAC business logic.

Q2: You can use either. The COMAPI is available from 5.0 while 4.1 and 4.2 can only use the xAPI. COMAPI is basically a wrapper around the xAPI (COMAPI uses the xAPI). COMAPI gives the programmer more options to move through the views and get at the information. For example the COMAPI has GoNext and GoPrevious methods to navigate the records in the view. The xAPI does not. Use the COMAPI.

Q3: You only connect to the ACCPAC SM (System Manager) and it must be installed locally. The SM will take care of the actual connection to the database. It will use the same connection that the ACCPAC program uses.

To open a connection you need to add a reference to the COMAPI library (VB IDE menu: Project|References). Then declase a session and DBLink object. Then open the Session object using a valid ACCPAC Database ID, user name and password.
Code:
   '// COMAPI session and DBLink object.
   Dim Session As New AccpacCOMAPI.AccpacSession
   Dim DBLink As AccpacCOMAPI.AccpacDBLink
   
   '// Open the ACCPAC Session.
   Session.Init "", "AS", "AS1000", "52A"
   Session.Open "ADMIN", "ADMIN, "SAMLTD", Date, 0, ""

   '// Set the DBLink object for the views.
   Set DBLink = Session.OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
All your views will now be opened from the DBLink object.

I don't understand what you mean by 'low level'. Please clarify.


zemp
 
Thanks zemp, I found your explanations really usefull.

P.S. By 'low lovel' I ment everithing you explained earlier - connect to SM, Views contain Business Logic and MS takes care of futher connection.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top