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
  • 0 in reply to John1966

    Also the error 65 is only found when using a try catch block. MsgBox(oSS.sLastErrorMsg) is not working because it just hangs up at that line and never gets there. i saw the same thing when i was trying to instantiate the session object using a path to the Workstation "home" directory instead of the Server "home" Directory. I saw mention of settings to allow external access. Could someone elaborate on that?

Children
  • 0 in reply to John1966

    the Allow External Access Option is selected in Company Maintenance and must be checked for each company in order for BOI to work.

    Also, if this is MAS 200, what happens if you run your code directly on the server instead of from the workstation?

    Thanks,

    Kent

  • 0 in reply to Kent Mackall

    I'm not sure what you mean by run it on the server Kent. Install the vb.net application on the server?

  • 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.