I am using the docs and examples from the Sage University BOI class. I cannot get past a certain point. The user has full access rights. This line returns a number "20000001" Dim TaskID As Integer = oSS.nLookupTask("GL_Account_ui") This line returns a number "100004" instead of the expected 1 or 0 retVAL = oSS.nSetProgram(TaskID) Then of course this line fails oGLAccount = oScript.NewObject("GL_Account_bus", oSS) Complete Code Below: Public Sub CreateConnectionDemo() oScript = CreateObject("ProvideX.Script") oScript.Init("M:\Best\Mas 200\Version4\Mas90\Home") oSS = oScript.NewObject("SY_Session") retVAL = oSS.nlogon() If retVAL = 0 Then User = Trim(InputBox("Enter User Name")) Password = Trim(InputBox("Enter Password")) retVAL = oSS.nSetUser(User, Password) End If If retVAL = 0 Then MsgBox(oSS.sLastErrorMsg) oSS.DropObject() oSS = Nothing oSS.WScript.Quit() End If retVAL = oSS.nSetCompany("TST") If retVAL = 0 Then MsgBox(oSS.sLastErrorMsg) oSS.DropObject() oSS = Nothing oSS.WScript.Quit() End If retVAL = oSS.nSetDate("G/L", "20050315") If retVAL = 0 Then MsgBox("SetDate Failed - " & oSS.sLastErrorMsg) Else retVAL = oSS.nSetModule("G/L") If retVAL = 0 Then MsgBox("SetModule Failed - " & oSS.sLastErrorMsg) Else MsgBox("Current Company: " & oSS.sCompanyName & vbCrLf & "Company Data Path: " & oSS.sPathCompany & vbCrLf & "Current Module: " & oSS.sModuleName & vbCrLf & "Module Date: " & oSS.sModuleDate) End If End If Dim TaskID As Integer = oSS.nLookupTask("GL_Account_ui") retVAL = oSS.nSetProgram(TaskID) If retVAL = 0 Then oGLAccount = oScript.NewObject("GL_Account_bus", oSS) Else Dim mssg = oSS.sLastErrorMsg MsgBox(mssg) End If 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)) If oSS.oSecurity.nCreateAccess = 1 Then MsgBox("User Has Create Privilages") Else MsgBox("User Does Not Have Create Privilages") End If oSS.nCleanUp() oSS.DropObject() oSS = Nothing oScript = Nothing End Sub
↧