How to set accpac session using Accpac COMAPI?
Create the session using Accpac Session manager
and we should to give Application id, Application Version ,Program name and one important thing
We should Create object handle to open accpac Session.
'Global Variables
Dim mSession as New AccpacSession
Dim Sessionmgr as new AccpacSessionManager
Dim ObjectHand as String
Dim mDbLink as AccpacDBLink
'Open Session:
Private sub Form_Load()
'Open Session
With SessionMgr
.AppId="XX"
.AppVersion="56A"
.ProgramName="XX1000"
.ServerName=""
.CreateObjectHandle(ObjectHand,0,mSession)
End With
If mSession.isOpened then
Set mDbLink=mSession.OpenDBLink(DBLinkType.Company,DBLinkFlags.ReadWrite)
End if
'Initialize Views
With adsView1
if .Active=false then
.DBLink=mDbLink
.Active=true
End if
End With
With adsView2
if .Active=false then
.DBLink=mDbLink
.Active=true
End if
End With
With adsView3
if .Active=false then
.DBLink=mDbLink
.Active=true
End if
End With
With adsView4
if .Active=false then
.DBLink=mDbLink
.Active=true
End if
End With
End Sub