Create Sales Order Lines Object from MS Access Module ( Second attempt )

Good Day,

I hope this message finds you well. I am currently facing an issue with a control I've created in MS Access that interacts with Sage100 (Standard 2020 v6.20.4). I'm reaching out to seek your assistance in resolving this matter.

The control performs the following actions:

  1. Logs into Sage100.
  2. Locates and sets the Sales Order, updating the UDF_SMI_Release value on the sales order header.
  3. Iterates through the lines of the Sales Order and updates the UDF_PMQTY value.
  4. write the line record.
  5. write the header record

However, I've encountered a problem. Despite receiving successful return values for edtLne (2), getVal (1), and setVal (1), the write line returns an error stating, "File does not exist: File: RA_Options." When I suppress the write line the header write preforms as expected but the values in the lines section of the Sales Order do not update.

I want to highlight that the Sage version I'm currently testing on has Scanco's PM and Multi-bin installed. Although these enhancements have caused interference with the User Interface (UI) and Business Object Interface (BOI) in the past, I am unsure if they are the cause of this particular issue.

I've included snippets of the associated code and a screenshot of the relevant access screen below:

I would greatly appreciate your expertise and guidance in resolving this issue. If there is any additional information or details you require, please let me know.

Best Regards,


Pasted code snippets: Access screenshot below:

setVal = oSOHdr.nSetKeyValue( "SalesOrderNo$", sSONo )
setKey = oSOHdr.nSetKey()
setVal = oSOHdr.nSetValue( "UDF_SMI_RELEASE$", bSMI )
MsgBox( IsObject( oSOHdr.oLines ) )
'movVal = oSOHdr.oLines.MoveFirst() '< Error line is commented
'Do While Not cBool( oSOHdr.oLines ) '< Error line is commented
edtLne = oSOHdr.oLines.nEditline( sLineKey ) return  value = 2
If edtLne = 0 Then : MsgBox("ERROR edit line method " & oSS.sLastErrorMsg) : Else MsgBox("Edit Line " & edtLne & ":"& sLineKey & " method Good") '< debug only
getVal = oSOHdr.oLines.nGetValue( "ItemCode$", sItemCode ) return value = 1
If getVal = 0 Then : MsgBox("ERROR Get value " & oSS.sLastErrorMsg) : Else MsgBox("Get Item " & getVal & ":" & sItemCode & " value Good") '< debug only
setVal = oSOHdr.oLines.nSetValue( "UDF_PMQTY", nPMQty ) return value = 1
If setVal = 0 Then : MsgBox("ERROR Set value " & oSS.sLastErrorMsg) : Else MsgBox("Set " & setVal & ":" & nPMQty & " Value method Good") '<debug only
wrtVal = oSOHdr.oLines.nWrite() '<Error #12
If wrtVal = 0 Then : MsgBox("Line Write ERROR > " & oSS.sLastErrorMsg) : Else MsgBox("Line wrtVal SO " & wrtVal & ":" & sSONo & sLineKey & " Good") '< debug only
'movVal = oSOHdr.oLines.MoveNext() '< Error
'Loop '<Error
wrtVal = oSOHdr.nWrite()
If wrtVal = 0 Then : MsgBox("ERROR wrtVal " & oSS.sLastErrorMsg) : Else MsgBox("wrtVal SONo " & sSONo & " Good") '< debug only
End If

  • 0


    Hi hope all is well, I have come across your posts on the old SageCity and StackOverflow platforms for more than 15 years and beyond. I was confident that if I persisted in my efforts, I would eventually find someone who could provide valuable feedback.

    Yes, the RMA module is installed and activated, and I realized that I should have been more attentive to my original post, and I had hoped that most readers would not point out the mistake. However, the last error message I received states, "Module J/C is not on file.", which makes no sense at all. I've requested that the reseller open a case with Sage and find the cause. My guess it is an oversight in unit testing.

    From MS Access I can write to the header object but not to the lines object and from within Sage I can write to both the header and lines objects with no problem, why this is, is beyond me.



  • 0 in reply to SKG HIBARS

    Make sure you clear LastErrorMsg before executing your command.  Often the message you see is from a long since executed command.

    oBusObj.LastErrorMsg = ""

    ...then do something for oBusObj, and immediately afterwards you know the LastErrorMsg is fresh.

  • 0 in reply to Kevin M

    OK will do.



Reply Children
No Data