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!

Error - Session is not initialized

Status
Not open for further replies.

muhaidib

Programmer
Sep 27, 2005
82
SA
I am using ACCPAC 5.2A version with all the service pack 4 installed and MS SQL server.

Following code generates error: Session is not initialized

Dim AccSession As New AccpacCOMAPI.AccpacSession
Dim CompDBLink As AccpacCOMAPI.AccpacDBLink
Dim AcPkView As AccpacCOMAPI.AccpacView
Dim strFilter As String
Dim strItemNo As String

On Error GoTo ACCPACErrorHandler
If AccSession.IsOpened Then
CompDBLink.Close
AccSession.Close
End If
AccSession.Init "", "IC", "IC1130", "52A" 'Prog ID Location Details
AccSession.EnforceAppVersion = False
AccSession.Open "ADMIN", "ADMIN", "IC707D", Date, 0, ""

Set CompDBLink = AccSession.OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)


CompDBLink.OpenView "IC2090", AcPkView 'View ID Locational Details

With AcPkView
.Init
strFilter = "(ITEMNO = " + strItemNo + ")"
.Browse strFilter, True
Do While .Fetch
strItemNo = .Fields("LOCATION")
Loop
.Close
Set AcPkView = Nothing
End With

Set CompDBLink = Nothing

This piece of code works fine till code: Set CompDBLink.....
On encountering the line "CompDBLink.OpenView "IC2090", AcPkView", it generates error "Session not initialized". The value of "AccSession.IsOpened" is TRUE.

I searched the forum and found that I am following the correct syntax. Still I am getting this error. Can someone Help to resolve this?
 
Thanks lot.
I typed IC2090 instead of IC0290.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top