AccpacSession Object

ACCPAC Common Controls

AccpacSession Object

The AccpacSession object represents an authenticated session with ACCPAC System Manager. It also serves as an entry point to other facilities of the ACCPAC COM API. All other objects in the ACCPAC COM API are created either directly or indirectly by the AccpacSession object.

Remarks

The Session object is the only object in the ACCPAC COM API that can be directly created by application programs. An application should create a Session object, initialize and open the session before other facilities in the API become available.

A session can be opened through either of these methods:

  • Initializing the session with a valid object handle, by calling Init. The object handle is usually supplied by System Manager, or if the application is launched by another application, the parent application. If a valid object handle is supplied during initialization, the session is automatically opened as well and does not require an explicit call to Open.

  • Opening the session by calling Open, and supplying the correct ACCPAC user name and password. Before calling Open, a session object must first be initialized by calling Init, with "" passed in as the object handle.

Example

The following Visual Basic code illustrates how to create and open the AccpacSession object:
 

Dim Session As AccpacCOMAPI.AccpacSession

Set Session = CreateObject("ACCPAC.Session")

Session.Open "ADMIN", "ADMIN", "SAMLTD", Date, 0, ""