Get NewObject Error 65 When Creating Sales Order object

SOLVED

On my development machine I am getting the error code "NewObject Error: 65" when trying to create a sales order object. Our MAS 200 installation is on an internal server local to our office but not on my machine. I am developing in C# but have created a VB class library to hold the VB code and added a reference to the class in my project.

Public Sub CreateSOConnection()
        Try
            ' Create and Init ProvideX.Script Object
            oPVX = CreateObject("ProvideX.Script")
            oPVX.Init("M:\Best\Mas 200\Version4\Mas90\Home")

            ' Create and Initialize Session Object
            oSS = oPVX.NewObject("SY_Session")
            oSS.nSetUser("abc", "abc123456")
            oSS.nSetCompany("TST")
            oSS.nSetDate("S/O", "20100531")
            oSS.nSetModule("S/O")

            ' Create Sales Order Business Object
            oSS.nSetProgram(oSS.nLookupTask("SO_SalesOrder_ui"))
            soORDER = oPVX.NewObject("SO_SalesOrder_bus", oSS) <== Fails Here

            ' Create Customer Business object
            oSS.nSetProgram(oSS.nLookupTask("AR_Customer_ui"))
            arCUST = oPVX.NewObject("AR_Customer_bus", oSS)

            MsgBox("Good")

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

Parents Reply Children
  • 0 in reply to John1966

    We did check the setting for External Access. turned it off and got an error. Turned it back on and it allowed the connection.

  • 0 in reply to John1966
    verified answer

    Found the Problem. I was pointing to the wrong folder. I copied the UNC path during the workstation setup. It was the wrong path. Was using "oScript.Init("\\####\Apps\Sage100ERP\v430Copy20140316\Mas90\Home")"

    When I should have been using "oScript.Init("\\####\Apps\Sage100ERP\MAS90\Home") "

    The odd thing is that it was allowing the creation of a GL object and an AR Object. But failing when creating an SO Object. I was also able to get back the information of the company and the users access on these lines.

    MsgBox("Read Access:"& CStr(oSS.oSecurity.nReadAccess)& vbCRLF &_

    "Create Access:" & CStr(oSS.oSecurity.nCreateAccess)& vbCRLF & _

    "Modify Access:" & CStr(oSS.oSecurity.nModifyAccess)& vbCRLF & _

    "Delete Access:" & CStr(oSS.oSecurity.nDeleteAccess))

    All of these things worked. Just not the SO Object creation. Hope this helps another newbie.