"The Module Code is Required" IM_PhysicalCountWrkst_rpt nSetKey()

SOLVED

I'm trying to script against IM_PhysicalCountWrkst_rpt but keep getting "The Module Code is Required" when calling nSetKey(). Script sample is below. We are running 5.10.4.0. Anyone have any suggestions on what to try?

Const HKEY_CURRENT_USER = &H80000001
Set oReg = GetObject("winmgmts:\\.\root\default:StdRegProv")
oReg.GetExpandedStringValue HKEY_CURRENT_USER,"Software\Sage Software\MAS 90 Business Desktop\Settings","MAS90RootDirectory",PathRoot
PathHome = PathRoot & "\Home"
Set oReg = Nothing

Set oScript = CreateObject ("ProvideX.Script")
oScript.Init(PathHome)
Set oSS = oScript.NewObject("SY_Session")

retVAL = oSS.nLogon()
If retVAL = 0 Then
 ShowError "Logon", oSS.sLastErrorMsg
End If

retVAL = oSS.nSetCompany("TST", 1)
If retVAL = 0 Then
 ShowError "SetCompany", oSS.sLastErrorMsg
End If

retVAL = oSS.nSetDate("I/M","20150128")
If retVAL = 0 Then
 ShowError "SetDate", oSS.sLastErrorMsg
End If

retVAL = oSS.nSetModule("I/M")
If retVAL = 0 Then
 ShowError "SetModule", oSS.sLastErrorMsg
End If

retVAL = oSS.nSetProgram(oSS.nLookupTask("IM_PhysicalCountWrkst_ui"))
If retVAL = 0 Then
 ShowError "SetProgram", oSS.sLastErrorMsg
End If

Set oPhysCount = oScript.NewObject("IM_PhysicalCountWrkst_rpt", oSS)

retVAL = oPhysCount.nSelectReportSetting("STANDARD")
If retVAL = 0 Then
 ShowError "SelectReportSetting", oPhysCount.sLastErrorMsg
End If

retVAL = oPhysCount.nSetKeyValue("ReportSetting$", "STANDARD")
If retVAL = 0 Then
 ShowError "SetKeyValue, ReportSetting$", oPhysCount.sLastErrorMsg
End If

retVAL = oPhysCount.nSetKeyValue("RowKey$", "1")
If retVAL = 0 Then
 ShowError "SetKeyValue, RowKey$", oPhysCount.sLastErrorMsg
End If

strOp = ""
retVAL = oPhysCount.nGetOptions(strOp)
If retVAL = 0 Then
 ShowError "GetOptions", oPhysCount.sLastErrorMsg
End If

retVAL = oPhysCount.nSetKey()  ' <-- Error here: "The Module Code is Required."
If retVAL = 0 Then
 ShowError "SetKey", oPhysCount.sLastErrorMsg
End If

'
'
'

Cleanup

Sub Cleanup
 If IsObject(oPhysCount) Then
  oPhysCount.DropObject()
 End If

 oSS.nCleanup()
 oSS.DropObject()
 Set oPhysCount = Nothing
 Set oSS = Nothing
 Set oScript = Nothing
End Sub

Sub ShowError(sOperation, sMessage)
 MsgBox "Error (" + sOperation + "): " + sMessage
 Cleanup 
 WScript.Quit
End Sub

 

Parents Reply Children
No Data